Higher order functions was difficult for me too this video helped.
I breezed through most of the JS tutorial, but that section scared me. It felt as if the tutor was speaking too fast. I sat down this morning to have a go at it and I solved it on the first try.
If they can split that exercise into different steps, it would be much easier to follow.
It’s also annoying that I had to use other resources aka. FreeCodeCamp to understand what was being taught.
Personally, I like symbols, and despise long descriptive variable names at the processing level. Had this lesson been less verbose it might have had a greater chance of dissemination. As it is, it even confuses me. But then…
I’ve yet to find THE video that enables my brain to wrap my head around this concept fully, but this one definitely helped me. FYI, I played this one at 1.75x speed which somehow helped. Just a suggestion.
There are basically two types of higher order functions: One that takes a function and then uses that function internally to arrive at a return value; for instance,
callback is a function that does something with each object in the array as forEach iterates that array.
where callback is a predicate function (returns a boolean) where only the array elements that satisfy the predicate will be added to the return array.
where the callback is a function to compute a new value from each of those values in Array and return an array of the new values.
where callback is a function that computes a value, such as
a + b while progressively reducing the Array elements to a single return value.
The other type is one that returns a function composed of the arguments passed in and that can be invoked at a later time.
times = a = > x => a * x f = times(5) console.log(f(25)) // 125
a is now a constant in
x is the parameter?
Think of maths…
f(x) = ax
f(x) = 5x.
This is very common functionality when we get into the stew of things. You’ll find a million uses for both forms of HOF as you progress. Definitely segue into deeper study if this is a hanging point. It will be time well spent, and I mean practice, not videos.
To be honest the higher order functions directions and teaching in this section is horrid. @Codeacademy please review this module it can use a lot of work. I understand functions and will say your jumping from 0 to 60 on this one!!!
trust me, (whoever it concerns) you will learn more on higher order functions from this playlist.