@@ -38,111 +38,111 @@ const :
38
38
39
39
*/
40
40
41
-
42
41
//var variables
43
42
console . log ( "----------var variables---------" ) ;
44
43
45
44
var vx = 10 ;
46
45
var vy = 20 ;
47
46
{
48
- console . log ( ' Inner-1 {} :' , vx , vy ) ;
47
+ console . log ( " Inner-1 {} :" , vx , vy ) ;
49
48
}
50
49
51
50
{
52
- var vx = 11 ; //this variable is same in outer and inner
53
- var vz = 30 ;
54
- console . log ( ' Inner-2 {} :' , vx , vy ) ;
51
+ var vx = 11 ; //this variable is same in outer and inner
52
+ var vz = 30 ;
53
+ console . log ( " Inner-2 {} :" , vx , vy ) ;
55
54
}
56
55
57
- console . log ( 'Globle-after-{} :' , vx , vy , vz ) ;
58
-
56
+ console . log ( "Globle-after-{} :" , vx , vy , vz ) ;
59
57
60
- function Vfoo1 ( ) {
61
- console . log ( ' Vfoo1:' , vx , vy , vz ) ;
58
+ function Vfoo1 ( ) {
59
+ console . log ( " Vfoo1:" , vx , vy , vz ) ;
62
60
}
63
61
Vfoo1 ( ) ;
64
62
65
- function Vfoo2 ( ) {
66
- //here function have same variables so it will assign as local variable.
67
- var vx = 1 ; //create local variable
68
- let vy = 2 ; //create local variable
69
- const vz = 3 ; //create local variable
70
- console . log ( 'Vfoo2:' , vx , vy , vz ) ;
71
-
63
+ function Vfoo2 ( ) {
64
+ //here function have same variables so it will assign as local variable.
65
+ var vx = 1 ; //create local variable
66
+ let vy = 2 ; //create local variable
67
+ const vz = 3 ; //create local variable
68
+ console . log ( "Vfoo2:" , vx , vy , vz ) ;
72
69
}
73
70
Vfoo2 ( ) ;
74
71
75
- console . log ( ' Globle-after-fun :' , vx , vy , vz ) ;
72
+ console . log ( " Globle-after-fun :" , vx , vy , vz ) ;
76
73
77
74
//let letiables
78
75
console . log ( "----------let variables---------" ) ;
79
76
80
77
let lx = 10 ;
81
78
let ly = 20 ;
82
79
{
83
- let lx = 11 ; // local variable with block.
84
- let lz = 30 ; // local variable with block.
85
- console . log ( ' Inner {} :' , lx , ly , lz ) ;
80
+ let lx = 11 ; // local variable with block.
81
+ let lz = 30 ; // local variable with block.
82
+ console . log ( " Inner {} :" , lx , ly , lz ) ;
86
83
}
87
84
88
- console . log ( "\nconsole.log('Globle-after-{} :',lx,ly,lz); //Error: lz is not defined means lz can not be access outside the block.\n" )
85
+ console . log (
86
+ "\nconsole.log('Globle-after-{} :',lx,ly,lz); //Error: lz is not defined means lz can not be access outside the block.\n"
87
+ ) ;
89
88
// console.log('Globle-after-{} :',lx,ly,lz); //Error: lz is not defined means lz can not be access outside the block.
90
89
91
- console . log ( 'Globle-after-{} :' , lx , ly ) ;
92
-
90
+ console . log ( "Globle-after-{} :" , lx , ly ) ;
93
91
94
- function Lfoo1 ( ) {
95
- console . log ( ' Lfoo1:' , lx , ly ) ;
92
+ function Lfoo1 ( ) {
93
+ console . log ( " Lfoo1:" , lx , ly ) ;
96
94
}
97
95
Lfoo1 ( ) ;
98
96
99
- function Lfoo2 ( ) {
100
- //here function have same variables so it will assign as local variable.
101
- var lx = 1 ; //Local variable
102
- let ly = 2 ; //Local variable
103
- const lz = 3 ; //Local variable
104
- console . log ( 'Lfoo2:' , lx , ly , lz ) ;
105
-
97
+ function Lfoo2 ( ) {
98
+ //here function have same variables so it will assign as local variable.
99
+ var lx = 1 ; //Local variable
100
+ let ly = 2 ; //Local variable
101
+ const lz = 3 ; //Local variable
102
+ console . log ( "Lfoo2:" , lx , ly , lz ) ;
106
103
}
107
104
Lfoo2 ( ) ;
108
105
109
- console . log ( "\nconsole.log('Globle-after-fun :',lx,ly,lz); //Error: lz is not defined means lz can not be access outside the function.\n" )
106
+ console . log (
107
+ "\nconsole.log('Globle-after-fun :',lx,ly,lz); //Error: lz is not defined means lz can not be access outside the function.\n"
108
+ ) ;
110
109
// console.log('Globle-after-fun :',lx,ly,lz); //Error: lz is not defined means lz can not be access outside the function.
111
- console . log ( ' Globle-after-fun :' , lx , ly ) ;
110
+ console . log ( " Globle-after-fun :" , lx , ly ) ;
112
111
113
112
//const constiables
114
113
console . log ( "----------const variables---------" ) ;
115
114
116
-
117
115
let cx = 10 ;
118
116
let cy = 20 ;
119
117
{
120
- let cx = 11 ; // local variable with block.
121
- let cz = 30 ; // local variable with block.
122
- console . log ( ' Inner {} :' , cx , cy , cz ) ;
118
+ let cx = 11 ; // local variable with block.
119
+ let cz = 30 ; // local variable with block.
120
+ console . log ( " Inner {} :" , cx , cy , cz ) ;
123
121
}
124
122
125
- console . log ( "\nconsole.log('Globle-after-{} :',cx,cy,cz); //Error: cz is not defined means cz can not be access outside the block.\n" )
123
+ console . log (
124
+ "\nconsole.log('Globle-after-{} :',cx,cy,cz); //Error: cz is not defined means cz can not be access outside the block.\n"
125
+ ) ;
126
126
// console.log('Globle-after-{} :',cx,cy,cz); //Error: cz is not defined means cz can not be access outside the block.
127
127
128
- console . log ( ' Globle-after-{} :' , cx , cy ) ;
128
+ console . log ( " Globle-after-{} :" , cx , cy ) ;
129
129
130
-
131
- function Cfoo1 ( ) {
132
- console . log ( 'Cfoo1:' , cx , cy ) ;
130
+ function Cfoo1 ( ) {
131
+ console . log ( "Cfoo1:" , cx , cy ) ;
133
132
}
134
133
Cfoo1 ( ) ;
135
134
136
- function Cfoo2 ( ) {
137
- //here function have same variables so it will assign as local variable.
138
- var cx = 1 ; //Local variable
139
- let cy = 2 ; //Local variable
140
- const cz = 3 ; //Local variable
141
- console . log ( 'Cfoo2:' , cx , cy , cz ) ;
142
-
135
+ function Cfoo2 ( ) {
136
+ //here function have same variables so it will assign as local variable.
137
+ var cx = 1 ; //Local variable
138
+ let cy = 2 ; //Local variable
139
+ const cz = 3 ; //Local variable
140
+ console . log ( "Cfoo2:" , cx , cy , cz ) ;
143
141
}
144
142
Cfoo2 ( ) ;
145
143
146
- console . log ( "\nconsole.log('Globle-after-fun :',cx,cy,cz); //Error: cz is not defined means cz can not be access outside the function.\n" )
144
+ console . log (
145
+ "\nconsole.log('Globle-after-fun :',cx,cy,cz); //Error: cz is not defined means cz can not be access outside the function.\n"
146
+ ) ;
147
147
// console.log('Globle-after-fun :',cx,cy,cz); //Error: cz is not defined means cz can not be access outside the function.
148
- console . log ( ' Globle-after-fun :' , cx , cy ) ;
148
+ console . log ( " Globle-after-fun :" , cx , cy ) ;
0 commit comments