Higher Order Functions - JavaScript Tutorial
What is a Higher Order Function in JavaScript?
Why do we need Higher Order functions?
And how can you use them to your advantage?
Higher Order Functions from the series "10 Things JS Developers Should Know"
by ColorCode.io, Sina Jazayeri
Full playlist here: • 20 Things JavaScript D...
This is episode 8 in a 10 part series I’m calling 10 things javascript developers should know but probably don’t. In this series, we’re going to cover some of the most fundamental and important parts of JavaScript that most of us don’t actually know, and barely touch. Today, for episode 8, we’re talking about Higher Order Functions, why they exist, and how to use them. Episode 8: Higher Order Functions. Let’s go!
All the code from this series is available here:
github.com/ColorCode/js-10-th...
0:00:00 Intro
0:01:11 What is a Higher Order Functions?
0:02:28 Example: setTimeout
0:03:33 Example: Array.filter
0:04:50 Example: Iterators and Loops
0:06:09 Chaining functions together
0:07:29 Function Factory
0:08:54 Conclusion
Пікірлер: 235
Episode 8: Higher Order Functions - JavaScript Tutorial 💻🎉
@simplesolutions289
2 жыл бұрын
what IDE do you use for these videos?
@ColorCodeio
2 жыл бұрын
@@simplesolutions289 Chrome DevTools
@caribbeanman3379
Жыл бұрын
4:45 BTW, I remember seeing on a JavaScript video that it's bad practice to use array notation to get a particular character from a string like you've done here with "n[0]". I don't remember the details of why it's bad. But it was suggested that it's better to use one of the string functions like n.slice(0,1) or n.charAt(0).
I don't understand why you don't have a lot more subscribers. I have went through several videos and found them very useful .
@ColorCodeio
2 жыл бұрын
Thank you :)
@CondeAlberto
Жыл бұрын
He is good indeed.
Sina, just a note of appreciation - your content and presentation are immaculate. You are one of the few educators who can employ humor so it contributes rather than detracts.
@ColorCodeio
Жыл бұрын
Thank you so much
Currently 8 weeks into a web development bootcamp and i'm extremely lost....your videos are really helping me out man thank you!
@ColorCodeio
2 жыл бұрын
That's awesome to hear! Good luck.
This series is very well done, and extremely clear and useful. Can't wait for the episode on closures.
@ColorCodeio
2 жыл бұрын
Thank you Alec!
i like the way you explain in detail and with examples and the way the videos are made, very modern, clean and each topic of the videos gets a "separate" part of the video, making it easy for us viewers.
@ColorCodeio
2 жыл бұрын
Thank you. Glad you found it useful.
I wasnt knowing for months like what it is to use this keyword with arrow functions.I legit didnt understand it.But now seeing your explaination made it all clear to me.You are a gem.
@ColorCodeio
2 жыл бұрын
Thank you. Glad it helped.
Yeah, I'm a Brazilian guy and i really liked this vídeo, thanks a lot!
This is the first video I watch from your channel and I have to say it is really good. The animations, explanation and everything. Thank you so much
@ColorCodeio
Жыл бұрын
Thanks Sofia
these edits are so clean and entertaining, i wish more people saw you
@ColorCodeio
2 жыл бұрын
I appreciate that
This is a great explanation, thank you Sina. You are doing a great job, so please don't stop.
@ColorCodeio
Жыл бұрын
👍
Loving this series, PLEASE DO MORE!
@ColorCodeio
Жыл бұрын
A lot more coming next month
All your videos are incredible useful, and super easy to understand! Thank you so much :)
Appreciate the bite sized approach to this content. Sometimes when you are researching something and you're staring down the barrel of a 45 minute video it can be defeating. Cheers :)
@ColorCodeio
2 жыл бұрын
Haha I hear you!
I really love the way you connect current concepts to previously taught concepts and many different ways to do the same thing. really man hatf off to you and well yeah merry christmas to you
@ColorCodeio
Жыл бұрын
You're very welcome!
Love the animations/transitions
Great work brother! Keep it up. Us newbs really appreciate this stuff, especially when it isn't ultra-dry/tedious like a lot of these videos tend to get.
@ColorCodeio
Жыл бұрын
Thank you
Really enjoying the 10 part series. Just finished an engagement and starting to interview for next engagement and studying like crazy to prepare for all those interview questions. Yes, prototype and classes came up in one interview and I stumbled all over the answers. I'm from New York City, enjoyed seeing the city out of your window. Miss it. Moved to Tampa 5 years ago and looking forward to moving back.
@ColorCodeio
Жыл бұрын
I miss my view too, although I'm still in NYC. Best of luck to you on your interviews. Let me know if I can help.
Love your videos man! You explain things very clearly and concisely while also keeping it fun at times with your jokes. Brilliant channel please keep it going until the end of time :)
@ColorCodeio
Жыл бұрын
Thanks! No plans to stop any time soon :)
Not sure if you'll see this, it's a year old video. I'm currently learning web development and your videos are one of the greatest resources I found. You deliver the info in a light yet effective way. Hopefully you won't give up on this channel and would continue publishing those awsome videos.
@ColorCodeio
Жыл бұрын
Of course I see your comment :) I have no plans to stop posting videos. Thank you for taking the time to write.
This was extremely helpful, the examples were awesome and the way you explained them made them all click for me. Thanks!
@ColorCodeio
Жыл бұрын
Great to hear!
great production quality and explanation! Made it easier to grasp.
@ColorCodeio
Жыл бұрын
Thanks! Glad to hear it
Another useful, informative and so nice to follow video from the sequence! I like your new studio, it looks, how to say, open and brighter, miss a little bit the live coding. I am looking forward for the next "Closures" video. Wish you all good! : )
@ColorCodeio
2 жыл бұрын
Closures video posted today: kzread.info/dash/bejne/k3ym2MtrqrfSkbg.html
Very concise, and very well explained - good job and thanks!
@ColorCodeio
2 жыл бұрын
👍
I just found your content and this is the first video I watch! Actually I agree with the last comment... why don't you have more subs!? Thanks for the amazing explanation! Quite easy to understand! Hugs from Brazil!
@ColorCodeio
Жыл бұрын
Welcome aboard! Sending you hugs back to Brazil from New York City.
Video Quality is really top notch! First thing I noticed, now to learn
@ColorCodeio
2 жыл бұрын
Thank you. Good luck!
Very well explained!
Wow! This really takes away the mystique of higher order functions for me after years of programming in TS. How they work is obvious to me now, hence this video did its job. I just never really gripped how functions sent in as arguments run the code for each element in a collection, but now seeing you write these higher order functions, I see how they do the processing in a black box just like they would for any other primitive argument type. Thank you!
@ColorCodeio
10 ай бұрын
Thanks for a great comment! Glad the video was helpful for you.
great video I had to subscribe because the production quality was so good thank you so much for a tutorial that a human can understand
@ColorCodeio
2 жыл бұрын
You’re welcome :)
The best explanation ever. Plus, a really good vibe.
@ColorCodeio
Жыл бұрын
🕺🏻
Crazy good quality! Keep it up mate
@ColorCodeio
2 жыл бұрын
Appreciate it!
Very clear and concise. Many thanks !
@ColorCodeio
Жыл бұрын
🙏
Welcome back!
@ColorCodeio
2 жыл бұрын
Good to be back :)
wow .. That was a perfect video which was totally engaging and crystal clear.
@ColorCodeio
6 ай бұрын
Glad it was helpful!
Loved it ❣️
Good fellas ❤ I just watched it awhile ago, what a coincidence!
Best channel: it was very good Sina
Please do a series on basics of React or React Native. But I guess then the audience will be very limited as you are still growing, but your work deserves a lot more views, fantastic work!!!
@ColorCodeio
2 жыл бұрын
Great suggestion
Thanks for sharing!
@ColorCodeio
Жыл бұрын
Thanks for watching!
Great video, thnx for such content
best explanation ever
I like the new format with no code typing. I did not even notice it until you said something about it. I think you might be on to something here.
How the hell does this video have less than 10k views? You're sooo good at explaining thi stuff, you deserve way more recognition. And btw, I'm subbing!
@ColorCodeio
Жыл бұрын
Thanks for subbing!
@DivineKelvin-km9vb
10 ай бұрын
Like howwww????
You earned my sub! Thank you for this clear explanation
@ColorCodeio
2 жыл бұрын
Awesome :)
thanks for the video
It was really useful I was doing challenges in leetcode and there are many challenges related to HOF You earned a subscriber
@ColorCodeio
Жыл бұрын
Awesome, thank you!
Thanks for another great video!
@ColorCodeio
2 жыл бұрын
You're welcome Chris
I'm studying to be a full stack developer, based in South Africa. I've seen a lot of webdev tutorial videos online but I'm yet to see someone who does it better! 👌
@ColorCodeio
Жыл бұрын
Thanks and good luck with your studies!
Helpful.
Random but i definitely had "Coffee shop radio 24/7 lofi hip hop beats" on while watching this and it made it even better. regardless, thank you for being eloquent and still throwing some jokes in.
@ColorCodeio
Жыл бұрын
You’re speaking my language. Love lofi beats when coding 🎧
You guys deserve way more attention.
@ColorCodeio
2 жыл бұрын
Thanks LooneyTune. Great name by the way 👍
i love this dudes videos lol , good shit big dog
Great video. New pre-created text is easy to follow but I much prefer the live coding because it shows examples of how you think through things. Also miss the NYC window, it made it feel informal and comfortable, but I'm sure you had practical reasons for the shift.
@ColorCodeio
2 жыл бұрын
Thanks Dave. I’m actually just a block away from the old studio but unfortunately I had to move on. Thanks for the feedback.
Amazing and Informative as always .......Good luck
@ColorCodeio
Жыл бұрын
Thanks!
thanks for your tutorial.
@ColorCodeio
Жыл бұрын
👍
THIS content is better than my bootcamp's content
@ColorCodeio
Жыл бұрын
Glad to hear it
Nice to discover you sir! fantastic tutorial
@ColorCodeio
Жыл бұрын
Thank you
The essentials of Higher Order Functions in JavaScript; so succinctly explained. Thanks, Sina {2023-06-21}
I really liked the old setup with the window ALOT better. Also your voice sounded better in the old setup. In the new one you clearly hear the resounding from the walls.
@ColorCodeio
2 жыл бұрын
Unfortunately I won't have access to the old studio anymore :( Good catch on the audio. The space is so new and the sound acoustics haven't been installed yet.
Awesome show!
@ColorCodeio
Жыл бұрын
Thank you
Great videos thank you. Just one thing I think could make them better would be if they were shorter/more concise.
Thanks 🙏
your voice beautiful , your joking is funny , your explanation is great, every time I see you - even in something I knew before - I benefit from new and very useful information and some funny as well😅 , Thank you Sina❤
@ColorCodeio
Жыл бұрын
Thank you
Awesome Goodfellas reference
@ColorCodeio
2 жыл бұрын
🇮🇹🇺🇸
Why the hell don't you have more subscribers?? Your content is soo good... Loved it. Subscribing
@ColorCodeio
2 жыл бұрын
Thanks for subbing!
Awesome 👏🏾
@ColorCodeio
2 жыл бұрын
Thank you brother Kato!
You got yourself a new subscriber! I'm having a hard time with functions and this somehow helped me understand ( still need more practice tho, any suggestions?)
@ColorCodeio
Жыл бұрын
Build build build. That's the best way to learn.
guy deserves more subs!
@ColorCodeio
2 жыл бұрын
Ty!
still in love with background music:))))
Youre the most underrated youtuber on the youtubes
@ColorCodeio
10 ай бұрын
Underrated comment! Thank you
nice clean background - great info on video
@ColorCodeio
Жыл бұрын
Thank you!
The way you explain code is easier to understand. I request you to record a content about React stuff if possible. Happy coding.
@ColorCodeio
Жыл бұрын
Maybe soon
This Channel is like Oasis in the big desert called JS🙃. Just a suggestion sir, along with youtube reels, you can post your linkedin account also here to get more audience attention.
Hello and very well explained topic How can you build your own higher order function Can you make a video about making our own higher order function like map or filter or reduce
عاشقتم سینا . تو بهترین استاد جهانی بهت افتخار میکنم
Great video! Very helpful. Also, I like your taste in films. Dark Knight and Goodfellas are great. ;)
@ColorCodeio
2 жыл бұрын
Haha thanks!
I've run into many tutorials describing what callbacks are but don't go into the specifics of why it's needed. I've always struggled to find the value of a callback; for instance, why do functions like setTimeout(), array methods, addEventListeners, need a function as a parameter instead of using primitive types to tell it what to do? Thanks so much for explaining this. Cheers!
@ColorCodeio
2 жыл бұрын
Glad it helped!
@dedmanraizd
2 жыл бұрын
@@ColorCodeio Just to clarify, if a function by definition is what something does, how should we see primitive types as?
God level stuff!
@ColorCodeio
6 ай бұрын
God level comment
@tushar207
6 ай бұрын
Thanks “STEVE”
Higher order functions FTW. Very handy in combination with Redux-Observable with or without React 😁
@ColorCodeio
2 жыл бұрын
Yes! The functional master has spoken!
As usually, super informative episode. Funny too, just not sure how much joe pesci would agree there ;)
@ColorCodeio
2 жыл бұрын
Haha thanks dude!
thanks alot
@ColorCodeio
Жыл бұрын
👍
عالی بود ایول
@ColorCodeio
Жыл бұрын
Merci
enjoyed learning!
Could you also explain in more detail function factories?
Like the new studio, or old I dunno 😅😂 Thanks for the explanation.
@ColorCodeio
Жыл бұрын
🙏
he deserves 1 million subscribers
@ColorCodeio
2 жыл бұрын
Soon :)
Thanks Dear So much Funny
ThankYou sir, May i know how to prepare those stunning animated ppt/slides...
@ColorCodeio
7 ай бұрын
I manually create the animations myself in Final Cut Pro and Apple Motion
éPICO MAN
finally someone i can understand
@ColorCodeio
Жыл бұрын
🙏
good stuff
@ColorCodeio
Жыл бұрын
🤘
Hi Sina, thank you for the lessons. I have benefited a lot from you. I have a question regarding SetTimeout()،Is it possible to change the display duration of a function from time to function so that it is displayed after initializing and executing the first function? Example : setTimeout(function(),2000); to: setTimeout(function2(),function1()); I hope you get the idea،Thank you, Sina.
@ColorCodeio
Жыл бұрын
As long as function1 returns an integer I don’t see why not.
Do you have testing code videos?
I'm pretty sure you're the coolest programmer ever.
@ColorCodeio
Жыл бұрын
Haha I doubt it but thank you!
function call stack is where i confuse all the time in HOF
Why so serious 😂😂😂, thank you for ur videos it helped me alooot.
This channel is soooo underestimated
@ColorCodeio
2 жыл бұрын
Thank you 🙏
I don’t understand most usages of higher order functions. Would love some help! There are separate issues. The example at 8:50 with a function that returns a function does not make sense at all. Why not just create a function that does the thing while taking in that parameter? What do you gain out of writing a function that returns an anonymous function that does the work instead of writing a function that does the thing in the first place? The issue I have with map and filter and the rest is separate. In specific usages they’re great. I see them chained often and this drives me crazy because of the inefficiency. Each loops over every element. Each creates a separate array which itself takes time and space. Instead of chaining multiple together (which seems to be common) I don’t understand why people don’t use a single loop with the logic so you only iterate over each element once and only need to create a single array to return in the process. For usages where you only use one or can only possibly iterate over a small number the inefficiency seems trivial. I’ve seen this done over tens of thousands of items and on a backend writing something twice as efficient feels like the way to go cutting down on database drag. Chaining multiple together feels like writing several separate loops each creating a bunch of data that only gets used to write another loop to create more data to write another loop …. Or you could write a single loop! Instead of taking in a function as a parameter, why not use scope to gain access to a function? What is the benefit to doing it this other way? This seems common with callbacks. Most of the time it seems more direct to just write the functionality so it’s available in scope.
That's great, also the quality is really high, even only the into can make u click the subscribe button.
@ColorCodeio
2 жыл бұрын
Haha thank you
With the makeClickHandler function, why return a function? Why not just have document.body.style.fontSize within makeClickHandler on its own? I'm sure there's a reason but I'm not able to see it at the moment.