How does item fit in exactly in the code

Hi I am having trouble understanding the second solution to the challenge, I was wondering if someone could explain every sentence in the code, and tell how does item fit in exactly in the code

/ As a function declaration AND using named function w/ a loop:*/

function justCoolStuff(firstArray, secondArray) {

      function isInSecondArray(item){

            for(let i = 0; i<secondArray.length; i++){

                  if (secondArray[i] === item){

                        return true

                  }

            }

            return false 

      }

      return firstArray.filter(isInSecondArray)

}

The filter iterator takes a function. The author can specify the parameter name.