RSRobince Studio

JavaScript Variables

A variable stores a value under a name. Use let for a value that can change and const for one that cannot.

let score = 10
const name = "Sam"
score = score + 5

Try it — change the values and run:

Try it yourself

Loading editor…

Prefer const by default, and only use let when you know the value needs to change. Avoid the old var.