File tree 1 file changed +46
-0
lines changed
1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ // var c = 200;
2
+ let a = 300 ;
3
+
4
+ if ( true ) {
5
+ let a = 10 ;
6
+ const b = 20 ;
7
+ var c = 30 ;
8
+ console . log ( "Inside block: " , a ) ; // 10
9
+ }
10
+
11
+ console . log ( a ) ; // 300
12
+ //console.log(a); // ReferenceError: a is not defined
13
+ //console.log(b); // ReferenceError: b is not defined
14
+ console . log ( c ) ; // 30
15
+
16
+ function one ( ) {
17
+ const username = "Henry" ;
18
+
19
+ function two ( ) {
20
+ const website = "youtube.com" ;
21
+ console . log ( username ) ; // Henry
22
+ }
23
+ //console.log(website); // ReferenceError: website is not defined
24
+ two ( ) ;
25
+ }
26
+ one ( ) ;
27
+
28
+ if ( true ) {
29
+ const username = "henry" ;
30
+ if ( true ) {
31
+ const website = " youtube.com" ;
32
+ console . log ( username + website ) ;
33
+ }
34
+ //console.log(website); // ReferenceError: website is not defined
35
+ }
36
+ //console.log(username); // ReferenceError: username is not defined
37
+
38
+ addOne ( 4 ) ; // 5
39
+ function addOne ( num ) {
40
+ return num + 1 ;
41
+ }
42
+
43
+ addTwo ( 4 ) ; // ReferenceError: Cannot access 'addTwo' before initialization
44
+ const addTwo = function ( num ) {
45
+ return num + 2 ;
46
+ } ;
You can’t perform that action at this time.
0 commit comments