forked from ga-wdi-exercises/checkpoint-javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhof.js
More file actions
35 lines (30 loc) · 939 Bytes
/
hof.js
File metadata and controls
35 lines (30 loc) · 939 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// NOTE: Make sure to use the `var` keyword for ALL variable declarations
var people = [
{
name: "Layla",
age: 27,
knownLanguages: 3
}, {
name: "Keanu",
age: 54,
knownLanguages: 1
}, {
name: "Jasmine",
age: 35,
knownLanguages: 2
}
]
// #1: Use the `map` array method to create a new array containing the names of each
// person in the `people` array. Assign the returned array to a variable
// called `peopleNames`.
// Type your solution immediately below this line:
var peopleNames = people.map((person) => {
return person.name
})
// #2: Use the `filter` array method to create a new, filtered array containing only
// persons from the `people` array who know multiple languages. Assign the returned array
// to a variable called `polyglotPeople`.
// Type your solution immediately below this line:
var polyglotPeople = people.filter((person) => {
return person.knownLanguages >= 2
})