const keyword in Javascript ES6

Posted in Tutorials

Tweet This Share on Facebook Bookmark on Delicious Digg this Submit to Reddit

The “const” keyword has the same block scope as the “let” keyword as shown in previous tutorial.  With const, whatever was assigned, can not be changed…

const keyword tutorial

Note that once “john” is assigned to “employee”, you can not assign anything else to “employee”.  And you need to perform the assignment at the time of declaration.

However, because “john” is an object, the properties within that object can be changed (as in the case of john’s age).

More features of ES6 here.