File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11<div align =" center " >
22
3- ![ Array cardio day 2 ] ( https://i.postimg.cc/pLM0bqwP/console.png )
3+ ![ Console screenshot ] ( https://i.postimg.cc/pLM0bqwP/console.png )
44
55</div >
Original file line number Diff line number Diff line change 11// Array Cardio Day 2
22
3+ "use strict" ;
4+
35const people = [
46 { name : "Wes" , year : 1988 } ,
57 { name : "Kait" , year : 1986 } ,
@@ -16,27 +18,26 @@ const comments = [
1618] ;
1719
1820// Some and Every Checks
19- let today = new Date ( ) ;
20- let currentYear = today . getFullYear ( ) ;
21+ const currentYear = new Date ( ) . getFullYear ( ) ;
2122
2223// Array.prototype.some()
2324// 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 ) ;
2526console . log ( a ) ;
2627
2728// Array.prototype.every()
2829// 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 ) ;
3031console . log ( b ) ;
3132
3233// Array.prototype.find()
3334// 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 ) ;
3536console . log ( comment ) ;
3637
3738// Array.prototype.findIndex()
3839// Find the comment with this ID
39- let index = comments . findIndex ( ( comment ) => comment . id === 823423 ) ;
40+ const index = comments . findIndex ( ( comment ) => comment . id === 823423 ) ;
4041console . log ( index ) ;
4142
4243// Delete the comment with the ID of 823423
You can’t perform that action at this time.
0 commit comments