Where does the num come from? How does the function knows that num refer to the elements of the array? As I see, there was no where when num was declared.
What do I think? num can be replaced with any random word, because the way filter() woks is assigning array elements to be worked on with the function. But its just a speculation.
the method feeds the elements to the callback function one by one, and then do something with the returned values of the callback to create the returned value of the method
the callback is just a function, but the arguments that are passed in are the elements of the array because that is what the map and filter methods do
The filter and map methods have been designed so that the first argument passed to the function represents the actual elements of the array, the second argument represents the indices of the array, and the third argument represents the original array in which the method was invoked. That is why if I have an array of numbers, I would typically name the first parameter num. If I had an array of movie titles, I would name the first parameter either movie or title or movieTitle. I typically name the second parameter index or idx.