Constantly Confusing ‘const’

added by bpwndaddy
9/9/2015 1:29:13 AM

784 Views

One of the new features in ES6 that has both garnered attention and caused a fair bit of confusion is the new const declaration keyword. I’m going to briefly wade through the morass to help you make sense of this feature. Like its cousin let External Link, the const keyword declares variables that are scoped to the nearest enclosing { } block, as opposed to var which attaches its variable declarations to the nearest enclosing function scope. But unlike let, const purports to declare constant variables. So what exactly does that mean and not mean?


0 comments