← JavaScript Essentials
JavaScript foundations · 15 MIN

Strings, numbers and template literals

Strings, numbers and template literals

Strings can use single quotes, double quotes or backticks. Template literals interpolate expressions and can span multiple lines. Convert input deliberately because form values are usually strings.

Try it yourself

Change the example, run it, and explain the result in your own words. Then create one variation of your own.

Key idea

Use the example as a starting point, not something to memorize. Practise, inspect the result and make small improvements.

Code example

const name = "Sam";
const total = 3 * 4;
console.log(`${name} has ${total} points`);