Write Higher Order Arrow Functions little confused with the syntax

so im just a little confused i think it may be to do with a lack of understanding of these higher level methods of arrays my code is working as far as ive gotten im just getting a little muddled as to why its like this and im really someone who likes to understand whats going on lol

const squaredIntegers = arr.filter(function(num){
if (num > 0 ){
return true;

why do i call a function without a name with a placeholder into filter i thought i wud just be able to filter(num) and that wud be the function its self why do i call a function inside the filter function?
many thanks

filter is a method that needs a callback function to work: filter expect a boolean from the callback frunction, and create a new array in which only the elements that returned true from the callback are present and those that returned false are not

1 Like