diff --git a/filter1.js b/filter1.js index 602ddc0..9067eb9 100644 --- a/filter1.js +++ b/filter1.js @@ -20,5 +20,7 @@ let people = [ // (1) Write code that uses the filter function, and the below isCool function to return a list of people who are cool. let isCool = person => person.coolnessScore > 20 - + // Your code goes here +const coolness = people.filter(isCool) +console.log(coolness) \ No newline at end of file diff --git a/filter2.js b/filter2.js index fd52f91..79f5717 100644 --- a/filter2.js +++ b/filter2.js @@ -4,3 +4,11 @@ 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 +// we want to grab the numbers and arrays +// filter is checking each index against the function provided and wants the result of said function to be true or false +const notStrings = misc.filter((index) => { + console.log(typeof (index)) + console.log(typeof (index) != "string") + return (typeof (index) != "string") +}) +console.log(notStrings) \ No newline at end of file diff --git a/foreach1.js b/foreach1.js index 7158aaa..5a9cb78 100644 --- a/foreach1.js +++ b/foreach1.js @@ -9,3 +9,6 @@ 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..57d09a5 100644 --- a/foreach2.js +++ b/foreach2.js @@ -11,4 +11,6 @@ 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..1ca0b45 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 prediction = forecast.map(weather => { + console.log(`${weather.day} will have a high of ${weather.high} and a low of ${weather.low}.`) +}) \ No newline at end of file diff --git a/map2.js b/map2.js index aa8ae04..8ecc59b 100644 --- a/map2.js +++ b/map2.js @@ -6,3 +6,10 @@ let numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9] // e.g. "36 is larger than 30" //Your code here +const square = (num) => { + for (let i = 1; i < num.length; i++) { + return Math.pow(numbers[i], 2) + } +} +//function square = numbers.Math.pow([i], 2) +console.log(square(numbers)) \ No newline at end of file