The const keyword is used to define a variable whose value shouldn’t change.

Difference between let and const

If you intend to modify the value in a variable, define it using let; otherwise, define it using const.

Example

Here’s an example that shows the difference between using let and const:

Get hands-on with 1200+ tech skills courses.