DEV Community

Cover image for Variables Comparison JS✍
Sudharshan S
Sudharshan S

Posted on

4 1

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)

Image of PulumiUP 2025

Let's talk about the current state of cloud and IaC, platform engineering, and security.

Dive into the stories and experiences of innovators and experts, from Startup Founders to Industry Leaders at PulumiUP 2025.

Register Now