Escape Sequence instructions: Other threads ignore error

There is an entire thread devoted to how to make the code correspond to these instructions, and people seem to think these are the instructions:

FirstLine newline , backslash SecondLine backslash , carriage-return ThirdLine

However, those are not the instructions. There is literally NO mention anywhere of a carriage return. Here are the EXACT instructions:

"
myStr should not contain any spaces

myStr should contain the strings FirstLine , SecondLine and ThirdLine (remember case sensitivity)

FirstLine should be followed by the newline character \n

myStr should contain a tab character \t which follows a newline character

SecondLine should be preceded by the backslash character \

There should be a newline character between SecondLine and ThirdLine

myStr should only contain characters shown in the instructions"

No carriage return. Where on earth is a carriage return in that set of instructions? What is going on?? Please help, I’m going nuts over this. Thanks :slight_smile:

The challenges get updated and changed every so often. I wouldn’t worry about old solutions that used to work.

Thanks, but I’m really struggling as I think my code is ok. I’m reading this:

FirstLine and linebreak followed by tab SecondLine and linebreak followed by ThirdLine.

My code looks like this:

var myStr;

myStr=“FirstLine\n \t SecondLine \n ThirdLine”// Change this line

I have all the /n and the /t as specified in instructions. I don’t understand why it’s saying "SecondLine should be preceded by the backslash character " when the instructions say there should be a tab in front of it.

Here’s a screnshot of the errors/instructions:

Please post your actual code instead of a screenshot. It is very hard to debug screenshots. A link to the challenge you are working on would also help.

I think you problem comes from the first failing test:

myStr should not contain any spaces.

Your code contains spaces.

Hi I took out the spaces. Now it’s not happy if I add the \ before SecondLine (which makes no sense as they are asking for \t) and if I take out the \ the error asks for it again.

var myStr;

myStr="FirstLine\n\t\SecondLine\nThirdLine"// Change this line

I really appreciate you taking the time to answer me. I’ve hit a bit of a slump and am trying to work through some major frustration. :slight_smile:

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

Thank you, I will use backticks from now on. That’s very helpful

You need to escape your backslash character to have it show in your string.

Ah, I overlooked that character. Understood now.

Also I just solved it (I remembered what I needed to escape).

Thank you! Tremendously helpful without giving it away.
:slight_smile:

1 Like

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