I know the difference between const
, let
, and var
:
- Scope
- Lack of hoisting
- The value of
const
variable cannot be changed.
But why ever use const
? Besides from the age old example with PI as 3.14, is there any other advantage then "cleaner code", which I find const
is really good for? Is there some efficiency upside to it, because the browser doesn't have to edit the variable?