Basic JavaScript: Escape Sequences in Strings

I was zipping through the JavaScript lessons with ease, and then this one brought me to stop. What the heck were they talking about?

It’s more clear if you look at the table and read, “If I want my string to display with a new line, I would use \n.” You’ll learn the lesson quicker by reverse-engineering it from the solution, which is:

var myStr = "FirstLine\n\tSecondLine\nThirdLine";

Leave a Reply

Your email address will not be published. Required fields are marked *