May 2019
Beginner to intermediate
650 pages
14h 50m
English
Strings are primitive types in JavaScript that can be created with single quotes or double quotes. There is no difference. It's only a matter of style. ES2015 introduced two new string features: template literals and multiline strings.
Multiline strings can be created adding a backslash at the end of each line:
const line = "Multiline strings can be \reated adding a backslash \at the end of each line";
Template literals are strings created with backticks. They allow the inclusion of JavaScript expressions inside ${} placeholders. The result is concatenated as a single string.
const template = `The square root of 2 is ${Math.sqrt(2)}`;
If you need to use a special character in a string, such as a double quote in a double quoted string, ...
Read now
Unlock full access