Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6a95b10

Browse files
committed
Completed exercise wesbos#7 of JS30.
1 parent 62f6fa9 commit 6a95b10

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,26 @@
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>

0 commit comments

Comments
 (0)