Difference between var and let and const keywords in JavaScript - ES6

var - this is function scoped variable. This variable will attach to window object so it is available for the whole page. Same variable name can be re declared every time with different values

let - this is blocked scoped ( if, while, for loop) variable.

const - this is same as let. Difference is variable values cannot be changed. The name implies it also the same. But we can change properties values of an object declared as const

Comments

Popular posts from this blog

Understanding Collection and Object Initializer

How to execute Javascript in VS code