@@ -38,111 +38,111 @@ const :
3838
3939*/
4040
41-
4241//var variables
4342console . log ( "----------var variables---------" ) ;
4443
4544var vx = 10 ;
4645var vy = 20 ;
4746{
48- console . log ( ' Inner-1 {} :' , vx , vy ) ;
47+ console . log ( " Inner-1 {} :" , vx , vy ) ;
4948}
5049
5150{
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 ) ;
5554}
5655
57- console . log ( 'Globle-after-{} :' , vx , vy , vz ) ;
58-
56+ console . log ( "Globle-after-{} :" , vx , vy , vz ) ;
5957
60- function Vfoo1 ( ) {
61- console . log ( ' Vfoo1:' , vx , vy , vz ) ;
58+ function Vfoo1 ( ) {
59+ console . log ( " Vfoo1:" , vx , vy , vz ) ;
6260}
6361Vfoo1 ( ) ;
6462
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 ) ;
7269}
7370Vfoo2 ( ) ;
7471
75- console . log ( ' Globle-after-fun :' , vx , vy , vz ) ;
72+ console . log ( " Globle-after-fun :" , vx , vy , vz ) ;
7673
7774//let letiables
7875console . log ( "----------let variables---------" ) ;
7976
8077let lx = 10 ;
8178let ly = 20 ;
8279{
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 ) ;
8683}
8784
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+ ) ;
8988// console.log('Globle-after-{} :',lx,ly,lz); //Error: lz is not defined means lz can not be access outside the block.
9089
91- console . log ( 'Globle-after-{} :' , lx , ly ) ;
92-
90+ console . log ( "Globle-after-{} :" , lx , ly ) ;
9391
94- function Lfoo1 ( ) {
95- console . log ( ' Lfoo1:' , lx , ly ) ;
92+ function Lfoo1 ( ) {
93+ console . log ( " Lfoo1:" , lx , ly ) ;
9694}
9795Lfoo1 ( ) ;
9896
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 ) ;
106103}
107104Lfoo2 ( ) ;
108105
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+ ) ;
110109// 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 ) ;
112111
113112//const constiables
114113console . log ( "----------const variables---------" ) ;
115114
116-
117115let cx = 10 ;
118116let cy = 20 ;
119117{
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 ) ;
123121}
124122
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+ ) ;
126126// console.log('Globle-after-{} :',cx,cy,cz); //Error: cz is not defined means cz can not be access outside the block.
127127
128- console . log ( ' Globle-after-{} :' , cx , cy ) ;
128+ console . log ( " Globle-after-{} :" , cx , cy ) ;
129129
130-
131- function Cfoo1 ( ) {
132- console . log ( 'Cfoo1:' , cx , cy ) ;
130+ function Cfoo1 ( ) {
131+ console . log ( "Cfoo1:" , cx , cy ) ;
133132}
134133Cfoo1 ( ) ;
135134
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 ) ;
143141}
144142Cfoo2 ( ) ;
145143
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+ ) ;
147147// 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