Variable

Names and abbreviations on this page

MDN — MDN Web Docs (formerly Mozilla Developer Network). Reference material for web programming.

Programming terms & practical skills

What it means

A variable is a named binding used to refer to a value in a program. Whether its value can be reassigned depends on the language and declaration. Clear names help readers understand what information is being used.

Related skills

Name meaningfullyPrefer monthlyRent over an unexplained letter.

Track valuesFollow where a value is created and changed.

Understand scopeIdentify where a name is available in the program.

An everyday example

In a housing comparison, monthlyRent might refer to 1200 and monthlyUtilities to 150. Keeping separate names makes it easier to see why the combined estimate is 1350.

What to check

Include units in names or documentation. A number representing dollars should not be combined with a number representing months by accident.

Related learning

Data type

Function

Algorithm

Learning & Skills

External Resources

MDN — Grammar and types