File tree Expand file tree Collapse file tree 3 files changed +6
-9
lines changed Expand file tree Collapse file tree 3 files changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ numbers[-10] = 'Value3';
6
6
numbers . field1 = 'Value1' ;
7
7
numbers [ 5 ] = 20 ;
8
8
9
- for ( const i of numbers ) {
10
- const value = numbers [ i ] ;
11
- console . log ( i , typeof i , value ) ;
9
+ for ( const value of numbers ) {
10
+ console . log ( value , typeof value ) ;
12
11
}
Original file line number Diff line number Diff line change 3
3
let i = 0 ;
4
4
while ( i < 10 ) {
5
5
i ++ ;
6
- console . log ( 'Hello' ) ;
6
+ console . log ( 'Hello' , i ) ;
7
7
if ( i === 5 ) continue ;
8
8
console . log ( 'World' ) ;
9
9
}
Original file line number Diff line number Diff line change @@ -15,10 +15,8 @@ const res = matrix
15
15
16
16
console . log ( res ) ;
17
17
18
- for ( const i in matrix ) {
19
- const row = matrix [ i ] ;
20
- for ( const j in row ) {
21
- const col = row [ j ] ;
22
- console . log ( i , j , col ) ;
18
+ for ( const row of matrix ) {
19
+ for ( const item of row ) {
20
+ console . log ( item ) ;
23
21
}
24
22
}
You can’t perform that action at this time.
0 commit comments