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.

Discussion (0)