Let me break down my use of reduce above:
return filteredArr.reduce((sum, val) => sum + val <= num ? val : 0, 0);
The reduce method has two parameters. The 1st parameter is a callback function which will be called on each element in the array. The 2nd parameter (which is optional) is the initial starting value you want to use for the accumulator argument in the callback function.
The main arguments you will typically use in the callback function are the first (known as the accumulator) and the second (the current element being iterated over). You can name these arguments anything you want, but it makes your code more readable to use names which describe what the arguments contain.
In each iteration, you must always return the accumulator, so that is starts with the last value it had in the previous iteration. The final value of the accumulator is what will get returned to where it was originally called.
In my example, I knew I wanted to create a running total (a sum) of all the Fibonacci numbers contained in filteredArr, so I named the accumulator argument sum. Next, I named the 2nd argument val, because each element is number. Normally, I would have used num as the argument name, but since I already had a num variable which I needed to compare each number in the array to, I had to use a different name.
I used arrow function syntax to make the code more concise. In each iteration I used the ternary operator to check if the current val was less than or equal to num. If it was, I added val to sum, otherwise I added 0. The sum was calculated and returned implicitly at the end of each iteration.
You will notice the extra , 0 at the end of the reduce statement. Here, I used the optional 2nd parameter to start the original value of the accumulator (sum) to zero. If could have left this off, if I knew for sure that there would always be at least one number in the array, but in general I typically like to initialize this parameter. If filteredArr was empty and I did not initialize the accumulator to zero, it would error out.