const
Learn how const introduces immutability in JavaScript and its limitations.
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 1400+ tech skills courses.