Strings
A string is indicated by enclosing a sequence of characters in either single quotation marks or double quotation marks. If you want to use one type of quotation mark inside a string, you can use the other type of quotation mark to indicate the beginning and ending of the string. Otherwise, you can use an escape characterA way to encode a special character.. Escape characters include:
Escape character | Meaning |
---|---|
\' |
' |
\" |
" |
\n |
new line |
\t |
tab |
\\ |
\ |
The empty string is formed by putting quotation marks next to each other without any characters in between, like this: ""
.
To concatenateTo make a new one by gluing together two. two strings, use +
.
Notice that a string appears in the console with double quotation marks, no matter which type of quotation mark is used in the script.
Glimpse of the future
Strings will be discussed in more detail in a discussion of strings as objects, after objects have been discussed.
Note:
Hints:
- undefined