-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGlobal_and_local_scope.js
More file actions
69 lines (48 loc) · 981 Bytes
/
Global_and_local_scope.js
File metadata and controls
69 lines (48 loc) · 981 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
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
// let a = 10;
// const b = 20;
// var c = 30;
// var c = 300;
let c = 300; // global Scope;
if (true) {
let a = 10;
const b = 20;
// inner scope
// var c = 30;
}
// console.log(a);
// console.log(b);
// console.log(c);
function one(){
const username = "Mohsin";
function two(){
const website = "youtube";
console.log(username);
}
// console.log(website);
// two();
}
// one();
if (true) {
const username = 'mohsin';
if (username==='mohsin') {
const website = 'youtube'
// console.log(username + website);
}
// console.log(website);
}
// console.log(username);
// ➡️©️✍🏻🏳️🟥
try {
console.log(addone(5)); // can acsees
function addone(num){
return num+1;
}
addone(5);
// addtwo(5); // get error
const addtwo = function(num){
return num +2;
}
addtwo(5);
} catch (error) {
console.log("plese hello");
}