File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change 2525 ] ;
2626
2727 // Some and Every Checks
28+ // .some checks if at least one thing in your array is a match for what you're looking for
29+
2830 // Array.prototype.some() // is at least one person 19?
2931 // const isAdult = people.some(function(person) {
3032 // const currentYear = (new Date()).getFullYear();
3335 // }
3436 // });
3537
38+ // Find who is 19 or older in my array
3639 const isAdult = people . some ( person => ( ( new Date ( ) ) . getFullYear ( ) ) - person . year >= 19 ) ;
3740
41+ // Curly braces around a variable in console.log = shows the name of the variable and value
3842 console . log ( { isAdult} ) ;
3943 // Array.prototype.every() // is everyone 19?
4044
4145 const allAdults = people . every ( person => ( ( new Date ( ) ) . getFullYear ( ) ) - person . year >= 19 ) ;
46+
4247 console . log ( { allAdults} ) ;
4348
4449 // Array.prototype.find()
You can’t perform that action at this time.
0 commit comments