let Binding

This lesson is all about assigning names to data so that it can be used later.

Keeping Track of Values

Storing data in an identifier is essential for almost any language. Identifiers facilitate the flow of information throughout a program. If we have a value that is being used in several places, it would be impractical to hardcode it again and again.

Attaching an identifier to the value would make the code more concise, more readable, and more reusable.

The let Identifier

The let keyword is used to assign, or bind, a name to a value. This value can now be accessed and modified through the corresponding name.

Apart from simple data types, let bindings can also be assigned to the results of expressions. The basic syntax for a let binding can be seen below:

Get hands-on with 1400+ tech skills courses.