-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy pathHoisting.js
More file actions
86 lines (65 loc) · 1.95 KB
/
Hoisting.js
File metadata and controls
86 lines (65 loc) · 1.95 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// // what is temporal dead zone => TDZ ?
// // Is let and const are hoisted => yes than proof that =>
// console.log("hey i am a =>", a); // undefined
// console.log(call); // i am not invoking the functions
// console.log("arrow with let", call2); // tdz
// console.log("arrow functions sections", call1); // i am not invoking the functions
// console.log("hey i am b =>", b); // tdz
// console.log("hey i am c =>", c); // tdz
// // declaring the variable
// var a;
// let b;
// const c = 40;
// function call() {
// var a = 40;
// console.log(a);
// }
// var call1 = () => {
// console.log("Hey I am arrow Functions");
// };
// let call2 = () => {
// console.log("Hey I am arrow with let variable Functions");
// };
// // console.log(a);
// ////
// ///
// ///
// //
// // console.log(a);
// // const a = "Hey I am constant";
// // console.log("Out of tdz", a);
// // redeclared
// var abc = 30;
// var abc = 40;
// // console.log(abc);
// // let abc2 = 50;
// // let abc2 = 50; Cannot redeclare block-scoped variable 'abc2'
// // const abc3 = 40;
// // const abc3 = 60; error => Cannot redeclare block-scoped variable 'abc3'
// // Reaasign
// // var abc4 = 40;
// // abc4 = 50;
// // console.log(abc4);
// // let abc5 = 60;
// // abc5 = 70;
// // const abc7 = 80;
// // // abc7 = 80; // TypeError: Assignment to constant variable.
// // var container1;
// // let container2;
// // // const container ; //Error = > 'const' declarations must be initialized.
// // // Var is functional scope and let and const is block-scoped
// // var a = 30;
// // function call() {
// // console.log(a); // undefined
// // var a = "happy face";
// // console.log(a); // happy faced
// // }
// // call();
// // console.log(a); // 30
// // declaration
// console.log(checkKnowledge); // whole function
// console.log(checkKnowledge()); // hey , undefined
// // syntax is diff
// // both are alocated memroy diffrerentl at the compliation
var a = 20;
var college = "XYZNEWTON";