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)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs