-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
64 lines (47 loc) · 991 Bytes
/
app.js
File metadata and controls
64 lines (47 loc) · 991 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
// Js Scopes
/*let a =10; //global scope
{
let a =50;
{
let a =30;
{
let a = 40;
}
}
}
console.log(a);
*/
/*let a =10; //global scope
{
let a =50;
{
let a = 30;
{
console.log(a); // get local scope value as output
}
}
}
console.log(a); // get global scope value as output*/
// block scope
let course = 'Engineering';
if (course === 'Engineering'){
let dept = 'Software';
}
console.log(course);
//console.log(dept); // dept is not defined error as dept is block scope variable
// function
/*let greet = function()
{
let msg = "Hello Good Morning ";
}
greet();
console.log(msg); // msg is not defined error as msg is function scope variable
// by using return we can get it
*/
let greet = function()
{
let msg = "Hello Good Morning ";
return msg;
}
let result = greet();
console.log(result);