Ad Code

Responsive Advertisement

Variables Declaration | Definition | Scope

 Variable Declaration | Definition

Three keywords are used to declare variables in JavaScript :
  1.     var 
  2.     let
  3.     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

Declaration and Definition


     

Post a Comment

0 Comments