Skip to content

Commit bc37fe9

Browse files
Update array cardio day 2 project
1 parent 73ca06d commit bc37fe9

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

07 - Array Cardio Day 2/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div align="center">
22

3-
![Array cardio day 2](https://i.postimg.cc/pLM0bqwP/console.png)
3+
![Console screenshot](https://i.postimg.cc/pLM0bqwP/console.png)
44

55
</div>

07 - Array Cardio Day 2/js/array.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// Array Cardio Day 2
22

3+
"use strict";
4+
35
const people = [
46
{ name: "Wes", year: 1988 },
57
{ name: "Kait", year: 1986 },
@@ -16,27 +18,26 @@ const comments = [
1618
];
1719

1820
// Some and Every Checks
19-
let today = new Date();
20-
let currentYear = today.getFullYear();
21+
const currentYear = new Date().getFullYear();
2122

2223
// Array.prototype.some()
2324
// Is at least one person 19 or older?
24-
let a = people.some((person) => 19 <= currentYear - person.year);
25+
const a = people.some((person) => 19 <= currentYear - person.year);
2526
console.log(a);
2627

2728
// Array.prototype.every()
2829
// Is everyone 19 or older?
29-
let b = people.every((person) => 19 <= currentYear - person.year);
30+
const b = people.every((person) => 19 <= currentYear - person.year);
3031
console.log(b);
3132

3233
// Array.prototype.find()
3334
// Find the comment with the ID of 823423
34-
let comment = comments.find((comment) => comment.id === 823423);
35+
const comment = comments.find((comment) => comment.id === 823423);
3536
console.log(comment);
3637

3738
// Array.prototype.findIndex()
3839
// Find the comment with this ID
39-
let index = comments.findIndex((comment) => comment.id === 823423);
40+
const index = comments.findIndex((comment) => comment.id === 823423);
4041
console.log(index);
4142

4243
// Delete the comment with the ID of 823423

0 commit comments

Comments
 (0)