Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions filter1.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ let people = [
let isCool = person => person.coolnessScore > 20

// Your code goes here

const result = people.filter(isCool)
console.log(result)
6 changes: 6 additions & 0 deletions filter2.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@ let misc = [3, "true", {a: 1, b: 2}, 7, [1, 2, 3], ['a', 'b', 'c'], "my favorite
// Don't worry about strings in the nested array (misc[5] is considered an array, not a string)

// Your code goes here

const result = misc.filter( str =>
typeof(str) !== typeof("string")
)

console.log(result)
2 changes: 2 additions & 0 deletions foreach1.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@
let foods = ["pizza", "tacos", "ice cream", "sushi"];

// your code here

foods.forEach(food => console.log(`I like ${food}`))
1 change: 1 addition & 0 deletions foreach2.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ let foods = [

// your code here

foods.forEach( food => console.log(`${food.name} is ${food.level} delicious`))
3 changes: 3 additions & 0 deletions map1.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@ let forecast = [
// "Monday will have a high of 55F and a low of 53F."

//Your code here

const weather = forecast.map( days => `${days.day} will have a high of ${days.high} and a low of ${days.low}`)
console.log(weather)
4 changes: 4 additions & 0 deletions map2.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ let numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9]
// e.g. "36 is larger than 30"

//Your code here

numbers = numbers.map(x => x*x)
numbers = numbers.filter(x => x > 30)
numbers = numbers.forEach(x => console.log(`${x} is larger than 30`))