This repository was archived by the owner on Feb 13, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change 3131 // return true;
3232 // }
3333 // });
34-
35- const isAdult = people . some ( person => ( ( new Date ( ) ) . getFullYear ( ) ) - person . year >= 19 ) ;
36-
34+ const isAdult = people . some ( person =>
35+ ( ( new Date ( ) ) . getFullYear ( ) ) - person . year >= 19
36+ ) ;
3737 console . log ( { isAdult} ) ;
38- // Array.prototype.every() // is everyone 19?
3938
40- const allAdults = people . every ( person => ( ( new Date ( ) ) . getFullYear ( ) ) - person . year >= 19 ) ;
39+ // Array.prototype.every() // is everyone 19?
40+ const allAdults = people . every ( person =>
41+ ( ( new Date ( ) ) . getFullYear ( ) ) - person . year >= 19
42+ ) ;
4143 console . log ( { allAdults} ) ;
4244
4345 // Array.prototype.find()
4446 // Find is like filter, but instead returns just the one you are looking for
4547 // find the comment with the ID of 823423
46-
47-
4848 const comment = comments . find ( comment => comment . id === 823423 ) ;
49-
5049 console . log ( comment ) ;
5150
5251 // Array.prototype.findIndex()
5655 console . log ( index ) ;
5756
5857 // comments.splice(index, 1);
59-
6058 const newComments = [
6159 ...comments . slice ( 0 , index ) ,
6260 ...comments . slice ( index + 1 )
You can’t perform that action at this time.
0 commit comments