File tree 2 files changed +8
-7
lines changed
2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change 1
1
<div align =" center " >
2
2
3
- ![ Array cardio day 2 ] ( https://i.postimg.cc/pLM0bqwP/console.png )
3
+ ![ Console screenshot ] ( https://i.postimg.cc/pLM0bqwP/console.png )
4
4
5
5
</div >
Original file line number Diff line number Diff line change 1
1
// Array Cardio Day 2
2
2
3
+ "use strict" ;
4
+
3
5
const people = [
4
6
{ name : "Wes" , year : 1988 } ,
5
7
{ name : "Kait" , year : 1986 } ,
@@ -16,27 +18,26 @@ const comments = [
16
18
] ;
17
19
18
20
// Some and Every Checks
19
- let today = new Date ( ) ;
20
- let currentYear = today . getFullYear ( ) ;
21
+ const currentYear = new Date ( ) . getFullYear ( ) ;
21
22
22
23
// Array.prototype.some()
23
24
// Is at least one person 19 or older?
24
- let a = people . some ( ( person ) => 19 <= currentYear - person . year ) ;
25
+ const a = people . some ( ( person ) => 19 <= currentYear - person . year ) ;
25
26
console . log ( a ) ;
26
27
27
28
// Array.prototype.every()
28
29
// Is everyone 19 or older?
29
- let b = people . every ( ( person ) => 19 <= currentYear - person . year ) ;
30
+ const b = people . every ( ( person ) => 19 <= currentYear - person . year ) ;
30
31
console . log ( b ) ;
31
32
32
33
// Array.prototype.find()
33
34
// Find the comment with the ID of 823423
34
- let comment = comments . find ( ( comment ) => comment . id === 823423 ) ;
35
+ const comment = comments . find ( ( comment ) => comment . id === 823423 ) ;
35
36
console . log ( comment ) ;
36
37
37
38
// Array.prototype.findIndex()
38
39
// Find the comment with this ID
39
- let index = comments . findIndex ( ( comment ) => comment . id === 823423 ) ;
40
+ const index = comments . findIndex ( ( comment ) => comment . id === 823423 ) ;
40
41
console . log ( index ) ;
41
42
42
43
// Delete the comment with the ID of 823423
You can’t perform that action at this time.
0 commit comments