Variable Declaration | Definition
Three keywords are used to declare variables in JavaScript :
- var
- let
- const
1. var keyword:
- Global scope
- can Re-declare
- can Re-define or reassign the value
- eg. var a=10;
2. let keyword:
- Block scope
- can not re-declare
- but can re-assign
- eg. let a=20; or let a="hello";
3. const keyword:
- Block scope
- can not re-declare
- can not re-assign
- eg. const pi=3.14;
Declaration and Definition

0 Comments