File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 2626
2727 // Some and Every Checks
2828 // Array.prototype.some() // is at least one person 19 or older?
29+ const isAdult = people . some ( person => ( ( new Date ( ) ) . getFullYear ( ) - person . year ) >= 19 ) ;
30+ console . log ( { isAdult} ) ;
31+
2932 // Array.prototype.every() // is everyone 19 or older?
33+ const allAdults = people . every ( person => ( ( new Date ( ) ) . getFullYear ( ) - person . year ) >= 19 ) ;
34+ console . log ( { allAdults} ) ;
3035
3136 // Array.prototype.find()
3237 // Find is like filter, but instead returns just the one you are looking for
3338 // find the comment with the ID of 823423
39+ const comment = comments . find ( comment => comment . id === 823423 ) ;
40+ console . log ( comment ) ;
3441
3542 // Array.prototype.findIndex()
3643 // Find the comment with this ID
3744 // delete the comment with the ID of 823423
45+ const index = comments . findIndex ( comment => comment . id == 823423 ) ;
46+ comments . splice ( index , 1 ) ;
3847
48+ console . table ( comments ) ;
3949 </ script >
4050</ body >
4151</ html >
You can’t perform that action at this time.
0 commit comments