JavaScript const keyword
constkeyword always creates a value which is scoped to the block in which it is declared.- Values created using
constare not mutable by value or reference. - So, all primitive values created using
constcan never be replaced by another value. - For non primitive values like
objectsandarrays, their references cannot be changed, but still they can be mutated.
This 4th point has always been tricky for new comers to JavaScript.