diff --git a/filter1.js b/filter1.js index 602ddc0..d4125da 100644 --- a/filter1.js +++ b/filter1.js @@ -22,3 +22,6 @@ let people = [ let isCool = person => person.coolnessScore > 20 // Your code goes here + +const result = people.filter(isCool) +console.log(result) \ No newline at end of file diff --git a/filter2.js b/filter2.js index fd52f91..8c9a5df 100644 --- a/filter2.js +++ b/filter2.js @@ -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) \ No newline at end of file diff --git a/foreach1.js b/foreach1.js index 7158aaa..d98d2fa 100644 --- a/foreach1.js +++ b/foreach1.js @@ -9,3 +9,5 @@ let foods = ["pizza", "tacos", "ice cream", "sushi"]; // your code here + +foods.forEach(food => console.log(`I like ${food}`)) \ No newline at end of file diff --git a/foreach2.js b/foreach2.js index 7c29104..8f3f000 100644 --- a/foreach2.js +++ b/foreach2.js @@ -12,3 +12,4 @@ let foods = [ // your code here +foods.forEach( food => console.log(`${food.name} is ${food.level} delicious`)) \ No newline at end of file diff --git a/map1.js b/map1.js index 9ec71f4..ac20610 100644 --- a/map1.js +++ b/map1.js @@ -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) diff --git a/map2.js b/map2.js index aa8ae04..3d407e0 100644 --- a/map2.js +++ b/map2.js @@ -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`))