Starlit Daily

📚 › JavaScript: make pages do things

3. Data types: numbers, strings, booleans

JavaScript has numbers (42, 3.14), strings ("text"), and booleans (true or false). typeof tells you the type of a value.

A template string uses backticks and ${...} to put values inside text: `Hi ${name}`.

Show example

let n = 42;
let s = "text";
console.log(typeof n, typeof s);

✍️ Your turn

Let age = 21 and print the text: I am 21 years old, using a template string.

← Back to course