O'Reilly logo

The JavaScript PocketGuide by Lenny Burdette

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

3. Strings

The Web is made up of text: HTTP is a text-based protocol, and browsers consume Web content in HTML text files. JavaScript handles text in a flexible, capable manner with the powerful String data type.

Escape Characters

You can surround characters with either single primes (′) or double primes (″) to create a string. But whichever symbol you use, you can’t use it again in the middle of the string because that will end the string early. However, you can escape any character with a backslash (\) to solve this or use single primes inside double primes (and vice versa).

image

Escape sequences are useful for other things too, such as for newlines ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required