Guided Notes

Strings, Numbers & Math

Template literals, string methods and search, number methods, and the Math object.

Strings and template literals

Slide 1 / 5

Strings are text in quotes: 'single', "double", or `backticks`.

Backticks create template literals, which can embed expressions and span lines:

const name = 'Ada'; const msg = `Hello, ${name}! You have ${3 + 2} messages.`;

They're clearer than joining with +: 'Hello, ' + name + '!'

Special characters use a backslash: \n (new line), \' (quote), \\ (backslash). str.length gives the number of characters.

← Loops