String Basics

Creating Strings

Example

Strings can use single quotes, double quotes or backticks. They are immutable: methods return new strings.

const a = 'single';
const b = "double";
const c = `backtick`;
const quote = "She said \"hi\"";      // escaping
console.log(a, b, c, quote);
console.log("Careeroza".length);
console.log("Careeroza"[0], "Careeroza".at(-1));

Output

single double backtick She said "hi"
9
C a

Escape Characters

CodeResult
\nnew line
\ttab
\\backslash
\", \'quotes