DEV Community

Cover image for Variables Comparison JSโœ
Sudharshan S
Sudharshan S

Posted on

Variables Comparison JSโœ

๐Ÿ‘‰ var -> Var can be re-assigned, re-defined and has a function-scope. When we declared outside the function, it has a global scope and it attached itself to the window object.

๐Ÿ‘‰ let -> Let can be re-assigned. Itโ€™s scope is within a block of code.

๐Ÿ‘‰ const -> Const cannot be re-assigned or re-defined. Itโ€™s scope is within a block of code.

Top comments (0)