Please explain this to me

const justCoolStuff = (firstArray, secondArray) => firstArray.filter(word => secondArray.includes(word))

What does this section do / what is that called?
(word => secondArray.includes(word))

That’s a callback function written in fat arrow syntax.
It does the same as this:

const justCoolStuff2 = function(firstArray, secondArray) { 
  return firstArray.filter(function(word){
		return secondArray.includes(word);
1 Like

Aghhhh, so is it like a function that takes a function as an argument?

Yes. The filter() method expects a function as an argument.
The callback function can take up to 3 parameters that will be implicitly passed to the function in this order:

  1. element of the array
  2. index of the element
  3. the whole array


const array1 = ['hello', 'world', '!', '?'];
const array2 = ['hello', 'user', '!', '?'];
const callbackFn = function(el, idx, arr){
		return array2.includes(el) && idx % 2 === 0;
console.log(array1.filter(callbackFn)); // ["hello", "!"]