Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 319d099

Browse files
Day 07 - Array Cardio Day 2
1 parent b364214 commit 319d099

File tree

3 files changed

+84
-2
lines changed

3 files changed

+84
-2
lines changed

‎07_day/index.html

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<title>07 Day</title>
7+
</head>
8+
9+
<body>
10+
<p><em>Please have a look at the JavaScript Console</em> 💁</p>
11+
<script>
12+
const people = [{
13+
name: 'Wes',
14+
year: 1988
15+
},
16+
{
17+
name: 'Kait',
18+
year: 1986
19+
},
20+
{
21+
name: 'Irv',
22+
year: 1970
23+
},
24+
{
25+
name: 'Lux',
26+
year: 2015
27+
},
28+
];
29+
30+
const comments = [{
31+
text: 'Love this!',
32+
id: 523423
33+
},
34+
{
35+
text: 'Super good',
36+
id: 823423
37+
},
38+
{
39+
text: 'You are the best',
40+
id: 2039842
41+
},
42+
{
43+
text: 'Ramen in my fav food ever',
44+
id: 123523
45+
},
46+
{
47+
text: 'Nice Nice Nice!',
48+
id: 542328
49+
}
50+
];
51+
52+
const isAdult = people.some(person => ((new Date()).getFullYear()) - person.year >= 19);
53+
54+
console.log({
55+
isAdult
56+
});
57+
58+
const allAdults = people.every(person => ((new Date()).getFullYear()) - person.year >= 19);
59+
console.log({
60+
allAdults
61+
});
62+
63+
const comment = comments.find(comment => comment.id === 823423);
64+
65+
console.log(comment);
66+
67+
const index = comments.findIndex(comment => comment.id === 823423);
68+
console.log(index);
69+
70+
const newComments = [
71+
...comments.slice(0, index),
72+
...comments.slice(index + 1)
73+
];
74+
</script>
75+
</body>
76+
77+
</html>

‎README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,9 @@ Thanks!
3737
### Day 5: 22 Jun 2018
3838
Learned few tips about flexbox. Planning to learn more about flexbox at [flexbox.io](http://flexbox.io/) soon.
3939

40-
### Day 6: 27 Dec 2016
41-
Learned about Fetch API, getting `.json()` from fetch response, ES6 spread operator.
40+
### Day 6: 23 Jun 2018
41+
Learned about Fetch API, getting `.json()` from fetch response, ES6 spread operator.
42+
43+
### Day 7: 24 Jun 2018
44+
Learned about new array methods like some, every, find, findIndex.
45+
![Day 7 of 30](https://pbs.twimg.com/media/C07gdtqUAAAtlyM.jpg)

‎index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<a class="active" href="./04_day/index.html">04 Day</a>
1616
<a class="active" href="./05_day/index.html">05 Day</a>
1717
<a class="active" href="./06_day/index.html">06 Day</a>
18+
<a class="active" href="./07_day/index.html">07 Day</a>
1819
</div>
1920
</body>
2021

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /