-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
42 lines (26 loc) · 843 Bytes
/
Copy pathindex.js
File metadata and controls
42 lines (26 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// variable
// let keyword
let intValue = 10;
console.log(intValue);
// Exception case
//console.log(intValue1); Cannot access 'intValue1' before initialization
//let intValue1= 20;
//var keyword
var intValue2 = 25;
console.log(intValue2);
//var intValue = 20;
//console.log(intValue); // Identifier 'intValue' has already been declared
intValue2 = 30; // once initialized var, it has scope throughout file.
console.log(intValue2);
// exception case
console.log(intValue3); // in output we get undefined
var intValue3 =40;
// const keyword
// one time declaration. It's value remains same throughout program.
const pi = 3.14;
console.log(pi);
//exception case
// pi = 4.5;
// console.log(pi); // Assignment to constant variable.
//console.log(int); //Cannot access 'int' before initialization
//const int = 3;