Basic JavaScript - Escape Sequences in Strings

Tell us what’s happening:
Describe your issue in detail here.

Your code so far

const myStr = ""; // Change this line

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36

Challenge: Basic JavaScript - Escape Sequences in Strings

Link to the challenge:

Hi there and welcome to our community!

Did you have a question about this challenge? Can you describe, in your own words, what you are having difficulty understanding please? The more you say, the more we can help!

The text FirstLine should be followed by the code for newline, tab, and backslash.

The text SecondLine should be followed by the code for newline.

The text ThirdLine should just be at the end of the string.

It should be one big string all connected with no spaces.


Example:

const myStr = "\tProduct\nPizza\tPrice\t10\\$";
console.log(myStr)
	Product
Pizza	Price	10\$

Sorry, not sure if we’re on the same page here :o

Here’s what I find in the challenge:

FirstLine
    \SecondLine
ThirdLine

Let me put it differently:

FirstLine[NEWLINE]
[TAB][LITERALLY]\SecondLine[NEWLINE]
ThirdLine

[LITERALLY] of course means, that the following character is to be taken as such (literally) and not interpreted as a control character, or as they say in the trade, the character needs to be escaped.

So, what character do you use in JS to replace the “[LITERALLY]”?

Or in one single line:

FirstLine[NEWLINE][TAB][LITERALLY]\SecondLine[NEWLINE]ThirdLine

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.