File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2727
2828 // Some and Every Checks
2929 // Array.prototype.some() // is at least one person 19 or older?
30+ console . log ( people . some ( person => new Date ( ) . getFullYear ( ) - person . year >= 19 ) ) ;
3031 // Array.prototype.every() // is everyone 19 or older?
32+ console . log ( people . every ( person => new Date ( ) . getFullYear ( ) - person . year >= 19 ) ) ;
3133
3234 // Array.prototype.find()
3335 // Find is like filter, but instead returns just the one you are looking for
3436 // find the comment with the ID of 823423
37+ const comment1 = comments . find ( comment => comment . id === 823423 ) ;
38+ console . log ( comment1 ) ;
3539
3640 // Array.prototype.findIndex()
3741 // Find the comment with this ID
3842 // delete the comment with the ID of 823423
39-
43+ const commentIndex = comments . findIndex ( comment => comment . id === 823423 ) ;
44+ console . log ( commentIndex ) ;
45+ comments . splice ( commentIndex , 1 ) ;
46+ console . table ( comments ) ;
4047 </ script >
4148</ body >
4249</ html >
You can’t perform that action at this time.
0 commit comments