Skip to content

Commit 3345dfa

Browse files
authored
Update index-FINISHED.html
1 parent 9c2f513 commit 3345dfa

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

07 - Array Cardio Day 2/index-FINISHED.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
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();
@@ -33,12 +35,15 @@
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()

0 commit comments

Comments
 (0)