What is the meaning of using a constant in JavaScript?
var and const do almost the same thing but const is unchangable.
What is the point of that and what situation would use const?
What is the meaning of using a constant in JavaScript? var and const do
Share
I’m guessing the advantage is that you’ll be sure your constant’s value doesn’t change, ever.
Which might also help the Javascript engine optimize things a bit, depending on its implementation.
Note though that, according to this page (const in MDN) :
So, using
constis probably not that much of a good idea.