September 2015
Intermediate to advanced
92 pages
1h 30m
English
CHAPTER 5
![]()
Strings
A string consists of a series of characters delimited by either double quotes or single quotes. Which notation to use is a matter of preference.
var s1 = "Hello";var s2 = ’ World’;
There are two operators that can operate on strings. For combining strings there is the plus sign (+), which is called the concatenation operator in this context. It has an accompanying assignment operator (+=) that appends a string to the end of a string variable.
var greeting = s1 + s2; // "Hello World"s1 += s2; // "Hello World"
To break a line within a string, a backslash must be added. This character escapes the newline character that in JavaScript ...
Read now
Unlock full access