Const keyword in JavaScript

Before ES2015  javascript variable has only two scopes i.e. Global Scope and Function Scope.

but in ES2015 they introduced the cinst keyword. this keyword provides Block scope variables. Block scope means Variables declared inside a block {} cannot be accessed from outside the block.once you declared the constant variable you cannot declared this vsriable again.once you assigned the value in const variable, you can not reassigned value again.



Comments

Popular posts from this blog

Primitive Data Types in java

let - Keyword in JavaScript (Block scope)

Coding Problem 4: Smallest window containing 0, 1 and 2 [GFG - Problem Solving]