freeCodeCamp / wiki

freeCodeCamp's deprecated wiki articles
http://www.freecodecamp.com/wiki
281 stars 308 forks source link

Javascript - Escape Sequences in Strings - \n and \r not interchangeable #1228

Closed MyNameIsURL closed 8 years ago

MyNameIsURL commented 8 years ago

This is the correct answer to the problem var myStr = "FirstLine\n\\SecondLine\\\rThirdLine"; but this var myStr = "FirstLine\r\\SecondLine\\\nThirdLine"; should work as well. It shouldn't matter if the newline is used first or the carriage return is used first as long as both are used according to the instructions. Should be a simple regex fix.

Rafase282 commented 8 years ago

You are on the wrong repo, it should be the main repo not the wiki one, also the instructions are to encode a specific sequence.