Why is it that when I add curly braces to the filter argument, it does not work?
// Write your code here:
function justCoolStuff(arr1,arr2){
var newArray = arr1.filter(word => {arr2.includes(word)});
return newArray
}
const coolStuff = ['gameboys', 'skateboards', 'backwards hats', 'fruit-by-the-foot', 'pogs', 'my room', 'temporary tattoos'];
const myStuff = [ 'rules', 'fruit-by-the-foot', 'wedgies', 'sweaters', 'skateboards', 'family-night', 'my room', 'braces', 'the information superhighway'];
console.log(justCoolStuff(myStuff, coolStuff))
Yet, when I remove the curly braces, the code will run. I thought that it is a function? That should be the right syntax for it or am I mistaken?
// Write your code here:
function justCoolStuff(arr1,arr2){
var newArray = arr1.filter((word) => arr2.includes(word));
return newArray
}
const coolStuff = ['gameboys', 'skateboards', 'backwards hats', 'fruit-by-the-foot', 'pogs', 'my room', 'temporary tattoos'];
const myStuff = [ 'rules', 'fruit-by-the-foot', 'wedgies', 'sweaters', 'skateboards', 'family-night', 'my room', 'braces', 'the information superhighway'];
console.log(justCoolStuff(myStuff, coolStuff))