Higher Order Functions in JavaScript Explained Simply
Тәжірибелік нұсқаулар және стиль
Higher Order Functions & Callback Functions in JavaScript Explained Simply
Linkedin: / teddy-smith-015ba61a3
Website: www.teddysmith.io
Github: github.com/teddysmithdev
In JavaScript, a higher-order function is a function that takes one or more functions as arguments, or returns a function as output. These functions are a powerful feature of the language that allow you to write concise and expressive code.
The best way to learn higher order functions (and likely the most “real-world”) is to look at “map()” and “filter()”. Both take functions as arguments where the function is applied to each element in an array.
Map
For example, consider the map function, which is used to apply a function to each element of an array and return a new array containing the results.
The map function is a higher-order function because it takes a function as its argument, in this case the function to apply to each element of the array.
Пікірлер: 23
You just gained a subscriber!! Thanks for teaching!
+1 subscriber, There is no way to make a simpler explanation. Thank you so much.
@TeddySmithDev
6 ай бұрын
No prob. Sweet name lol
I'm mad I didn't find your channel sooner. God tier instructor... thank you!!!
Awesome!!! Thank you for making this video!!! :)
good lord, all I had needed was the explanation of func vs func(). It all makes sense now, thanks!
That's exactly what I was looking for. Thanks!
Wow 👏.. You've just simplified everything to my understanding. I'm your new subscriber.
You, sir, now have a new subscriber. Great lesson, thank you!
Thank you so much ! ❤
I love you for this bro.
Awesome explanation! Thank you very much! The explanation with the return()() helped me a lot :D
Haha you make these video’s entertaining and educational 👍
@TeddySmithDev
Жыл бұрын
I notice when I say something crazy in the beginning the watch time goes up Lmao
@caseyspaulding
Жыл бұрын
@@TeddySmithDev yea man I think you are onto something. Lol. Then I learn about roided out function passing to another function. Pretty cool haha
@TeddySmithDev
Жыл бұрын
lmao
Partial application
this actually made it more confusing
@grahamtech
6 ай бұрын
nvm it actually makes sense now lol
@TeddySmithDev
6 ай бұрын
I real life laughed lol
G0D approves
you just explained how it is done. but the important thing to know is why is it done this way? wrapping a function using another function, why? what r the benefits? it seems extra useless step.
@TeddySmithDev
7 ай бұрын
so that you can execute code within code. also, the code can be modified and changed to whatever you want because it is being passed in. instead of hard coding it you just pass it in.