Skip to content

Commit 6e0ac9e

Browse files
committed
Day 07
1 parent e762455 commit 6e0ac9e

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,20 @@
2424
{ text: 'Nice Nice Nice!', id: 542328 }
2525
];
2626

27+
// const ofAge = people.some(function(person) {
28+
// const currYear = (new Date()).getFullYear();
29+
// if(currYear - person.year >= 19) {
30+
// return true;
31+
// }
32+
// })
33+
// console.log(ofAge)
34+
35+
const ofAge = people.every(function(person) {
36+
const currYear = (new Date()).getFullYear();
37+
return currYear-person.year >=19
38+
})
39+
40+
console.log(ofAge)
2741
// Some and Every Checks
2842
// Array.prototype.some() // is at least one person 19?
2943
// Array.prototype.every() // is everyone 19?
@@ -32,6 +46,20 @@
3246
// Find is like filter, but instead returns just the one you are looking for
3347
// find the comment with the ID of 823423
3448

49+
const found = comments.find(function(message) {
50+
return message.id === 823423
51+
})
52+
53+
console.log(found)
54+
55+
const foundIndex = comments.findIndex(function(message) {
56+
return message.id === 823423
57+
58+
})
59+
60+
comments.splice(foundIndex, 1)
61+
console.log(comments)
62+
3563
// Array.prototype.findIndex()
3664
// Find the comment with this ID
3765
// delete the comment with the ID of 823423

0 commit comments

Comments
 (0)