K
K
KGZVER2020-07-30 11:45:40
JavaScript
KGZVER, 2020-07-30 11:45:40

In what direction to solve the Algorithmic problem?

When applying for an internship as a JS developer, they are required to solve such a problem, I can’t understand what form the answer should be in general? Should I write a function where the code is replaced using the replace method or what? The question is not for the sake of getting a ready-made solution, I just want to know in which direction I should move, there are 10 such tasks.

Write a program that converts the message text into HTML.
Input data format
The input file contains from 1 to 100 lines of no more than 100 characters, containing the message text.
Output data format Output the
input text to the output file after replacing the specified BB-codes with HTML-codes.

For example:
Input data - [b][b][/b]
Output - [b] tag b in html (for some reason the code itself disappears when the question is posted)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
dmshar, 2020-07-30
@KGZVER

Should I write a function where the code is replaced using the replace method or what?

What bothers you? What is not a theoretical question?
Yes, write. For one thing they want to see the style of writing your code, and on the example of 10 tasks - and the general level of ownership of the "tool".

S
Sergey Sokolov, 2020-07-30
@sergiks

Write a program

Write more than just a function. "It" should be able to read and write local files.
[b][b][/b] --> [b]<b></b>
Look for pairs of opening-closing from the inside out.
For "inspiration" you can find ready-made implementations of MarkDown parsers in JS.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question