Skip to content
GyanStudio
New programmers · 7 min

Variables and values

Store values with const and let, and choose a declaration based on whether reassignment is needed.

Learning objective

Choose between const and let, and predict the value held by a variable after reassignment.

01

A name for a value

A variable gives a value a name so you can use it later. Prefer const when the binding will not be reassigned.

Example

const courseName = 'JavaScript';

02

When a value must change

Use let when you need to reassign the variable. The new value must still follow the language’s type and syntax rules.

Example

let score = 0; score = score + 1;

03

Bindings and objects

const prevents reassignment of the binding, but it does not make an object’s properties immutable.

Example

const learner = { name: 'Asha' }; learner.name = 'Ravi';

Knowledge check

Try it yourself

Which declaration is the best fit for a value that should not be reassigned?
Your answer stays on this device.
About this lesson

Source: Original GyanStudio learning material. Editorial review pending. Last updated 5 November 2026.

This learning preview is not an official exam notice or a substitute for checking the relevant authority’s current information.