JS: Quote String
Template String with `GRAVE ACCENT`
`GRAVE ACCENT delimiter`
Allow embedded variable and expression, allow literal newline.
'APOSTROPHE' delimiter string
'APOSTROPHE delimiter'
Basically same as QUOTATION MARK delimiter string.
"QUOTATION MARK" Delimited String
Use QUOTATION MARK delimiter to enclose string.
console.log("my cat"); // my cat
Use \" to embed a QUOTATION MARK.
console.log("he said \"yes\""); // he said "yes"
Literal Newline Not Allowed
// illegal syntax. Literal newline is not allowed /* let xx = "a b"; */ // error: The module's source code could not be parsed
Include newline
Use \n for newline.
console.log("cat\ndog"); /* cat dog */
String Escape Sequence (backslash sequence)
Backslash at end of line continues the line without linebreak
// Backslash at end of line continues the line without linebreak let xx = "a\ b"; console.log(xx); // ab
JavaScript. String
- JS: String Overview
- JS: Quote String
- JS: Apostrophe Delimiter String
- JS: Template String
- JS: String Escape Sequence
- JS: Unicode Escape Sequence
- JS: String Operations
- JS: Iterate String
- JS: String Code Unit
- JS: Count Chars in String 📜
- JS: Tagged Template String
- JS: Regular Expression Functions
- JS: Convert String and Number
- JS: String (class)
- JS: String Constructor
- JS: String.prototype