GAME DEV 2026 ยท JAVASCRIPT FUNDAMENTALS

t1a06 โ€” Proper Names and Variables by Innes

Variables store information so a program can use and change it. Good variable names make code easier to understand.

Reference: JavaScript Variables

HTML formatting

This is bold text. HTML describes the content, while CSS controls its appearance.

Example variables

let myNum = 3;             // number
let myString = ' Hello ';  // string
let myFloat = 17.5;        // decimal number
let myBool = true;         // Boolean (true or false)

const myName = 'Innes';    // constant string

A variable name should describe the value it stores. JavaScript names are case-sensitive: myNum and mynum are different names. Use let when a value can change and const when it should not be reassigned.

Output

Click the button to display the variables.

Boolean toggle

Current value: true

A Boolean has only two values: true and false. The ! operator reverses the value.

Challenge

Add a variable for your favourite game, then display it with the other values. Try changing myNum and myFloat too.