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

  • @ColorCodeio
    @ColorCodeio2 жыл бұрын

    Episode 8: Higher Order Functions - JavaScript Tutorial 💻🎉

  • @simplesolutions289

    @simplesolutions289

    2 жыл бұрын

    what IDE do you use for these videos?

  • @ColorCodeio

    @ColorCodeio

    2 жыл бұрын

    @@simplesolutions289 Chrome DevTools

  • @caribbeanman3379

    @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).

  • @catbros4life
    @catbros4life2 жыл бұрын

    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

    @ColorCodeio

    2 жыл бұрын

    Thank you :)

  • @CondeAlberto

    @CondeAlberto

    Жыл бұрын

    He is good indeed.

  • @camcairns2584
    @camcairns2584 Жыл бұрын

    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

    @ColorCodeio

    Жыл бұрын

    Thank you so much

  • @XCrimsonPyroX
    @XCrimsonPyroX2 жыл бұрын

    Currently 8 weeks into a web development bootcamp and i'm extremely lost....your videos are really helping me out man thank you!

  • @ColorCodeio

    @ColorCodeio

    2 жыл бұрын

    That's awesome to hear! Good luck.

  • @aleclloydprobert6897
    @aleclloydprobert68972 жыл бұрын

    This series is very well done, and extremely clear and useful. Can't wait for the episode on closures.

  • @ColorCodeio

    @ColorCodeio

    2 жыл бұрын

    Thank you Alec!

  • @viorelmnk
    @viorelmnk2 жыл бұрын

    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

    @ColorCodeio

    2 жыл бұрын

    Thank you. Glad you found it useful.

  • @riteeshpai2369
    @riteeshpai23692 жыл бұрын

    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

    @ColorCodeio

    2 жыл бұрын

    Thank you. Glad it helped.

  • @brunog2766
    @brunog2766Ай бұрын

    Yeah, I'm a Brazilian guy and i really liked this vídeo, thanks a lot!

  • @SofiaLopez-uw7pf
    @SofiaLopez-uw7pf Жыл бұрын

    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

    @ColorCodeio

    Жыл бұрын

    Thanks Sofia

  • @lloydchan9606
    @lloydchan96062 жыл бұрын

    these edits are so clean and entertaining, i wish more people saw you

  • @ColorCodeio

    @ColorCodeio

    2 жыл бұрын

    I appreciate that

  • @otabekkadirov2578
    @otabekkadirov2578 Жыл бұрын

    This is a great explanation, thank you Sina. You are doing a great job, so please don't stop.

  • @ColorCodeio

    @ColorCodeio

    Жыл бұрын

    👍

  • @MohyDev
    @MohyDev Жыл бұрын

    Loving this series, PLEASE DO MORE!

  • @ColorCodeio

    @ColorCodeio

    Жыл бұрын

    A lot more coming next month

  • @elielberra2867
    @elielberra28673 ай бұрын

    All your videos are incredible useful, and super easy to understand! Thank you so much :)

  • @speedhaak
    @speedhaak2 жыл бұрын

    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

    @ColorCodeio

    2 жыл бұрын

    Haha I hear you!

  • @SahilPatel-zn3lo
    @SahilPatel-zn3lo Жыл бұрын

    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

    @ColorCodeio

    Жыл бұрын

    You're very welcome!

  • @kemekenneth
    @kemekenneth11 ай бұрын

    Love the animations/transitions

  • @paulsisson8944
    @paulsisson8944 Жыл бұрын

    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

    @ColorCodeio

    Жыл бұрын

    Thank you

  • @georgetuccio6053
    @georgetuccio6053 Жыл бұрын

    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

    @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.

  • @Jok3rundead
    @Jok3rundead Жыл бұрын

    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

    @ColorCodeio

    Жыл бұрын

    Thanks! No plans to stop any time soon :)

  • @karimmaged5024
    @karimmaged5024 Жыл бұрын

    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

    @ColorCodeio

    Жыл бұрын

    Of course I see your comment :) I have no plans to stop posting videos. Thank you for taking the time to write.

  • @kylemyers5802
    @kylemyers5802 Жыл бұрын

    This was extremely helpful, the examples were awesome and the way you explained them made them all click for me. Thanks!

  • @ColorCodeio

    @ColorCodeio

    Жыл бұрын

    Great to hear!

  • @mackenkie
    @mackenkie Жыл бұрын

    great production quality and explanation! Made it easier to grasp.

  • @ColorCodeio

    @ColorCodeio

    Жыл бұрын

    Thanks! Glad to hear it

  • @vladislavamarkova8379
    @vladislavamarkova83792 жыл бұрын

    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

    @ColorCodeio

    2 жыл бұрын

    Closures video posted today: kzread.info/dash/bejne/k3ym2MtrqrfSkbg.html

  • @nemanjakaran8799
    @nemanjakaran87992 жыл бұрын

    Very concise, and very well explained - good job and thanks!

  • @ColorCodeio

    @ColorCodeio

    2 жыл бұрын

    👍

  • @pedrolelis7854
    @pedrolelis7854 Жыл бұрын

    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

    @ColorCodeio

    Жыл бұрын

    Welcome aboard! Sending you hugs back to Brazil from New York City.

  • @UncleNabs
    @UncleNabs2 жыл бұрын

    Video Quality is really top notch! First thing I noticed, now to learn

  • @ColorCodeio

    @ColorCodeio

    2 жыл бұрын

    Thank you. Good luck!

  • @danivermel
    @danivermel Жыл бұрын

    Very well explained!

  • @Ratchet2022
    @Ratchet202210 ай бұрын

    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

    @ColorCodeio

    10 ай бұрын

    Thanks for a great comment! Glad the video was helpful for you.

  • @justingarner5425
    @justingarner54252 жыл бұрын

    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

    @ColorCodeio

    2 жыл бұрын

    You’re welcome :)

  • @videoklubi
    @videoklubi Жыл бұрын

    The best explanation ever. Plus, a really good vibe.

  • @ColorCodeio

    @ColorCodeio

    Жыл бұрын

    🕺🏻

  • @dennisa6449
    @dennisa64492 жыл бұрын

    Crazy good quality! Keep it up mate

  • @ColorCodeio

    @ColorCodeio

    2 жыл бұрын

    Appreciate it!

  • @raulnardone7062
    @raulnardone7062 Жыл бұрын

    Very clear and concise. Many thanks !

  • @ColorCodeio

    @ColorCodeio

    Жыл бұрын

    🙏

  • @hrahman3123
    @hrahman31232 жыл бұрын

    Welcome back!

  • @ColorCodeio

    @ColorCodeio

    2 жыл бұрын

    Good to be back :)

  • @anithadharaneedharan6758
    @anithadharaneedharan67586 ай бұрын

    wow .. That was a perfect video which was totally engaging and crystal clear.

  • @ColorCodeio

    @ColorCodeio

    6 ай бұрын

    Glad it was helpful!

  • @devesh21
    @devesh21 Жыл бұрын

    Loved it ❣️

  • @user-kn4oi9oh4i
    @user-kn4oi9oh4iАй бұрын

    Good fellas ❤ I just watched it awhile ago, what a coincidence!

  • @fatahbe7667
    @fatahbe7667 Жыл бұрын

    Best channel: it was very good Sina

  • @syedaun5410
    @syedaun54102 жыл бұрын

    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

    @ColorCodeio

    2 жыл бұрын

    Great suggestion

  • @ludwigvillalba1886
    @ludwigvillalba1886 Жыл бұрын

    Thanks for sharing!

  • @ColorCodeio

    @ColorCodeio

    Жыл бұрын

    Thanks for watching!

  • @Aziz-kw6ct
    @Aziz-kw6ct11 ай бұрын

    Great video, thnx for such content

  • @ivandedic3857
    @ivandedic3857 Жыл бұрын

    best explanation ever

  • @bmehder
    @bmehder2 жыл бұрын

    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.

  • @brolino11
    @brolino11 Жыл бұрын

    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

    @ColorCodeio

    Жыл бұрын

    Thanks for subbing!

  • @DivineKelvin-km9vb

    @DivineKelvin-km9vb

    10 ай бұрын

    Like howwww????

  • @mynamesgeoff1612
    @mynamesgeoff16122 жыл бұрын

    You earned my sub! Thank you for this clear explanation

  • @ColorCodeio

    @ColorCodeio

    2 жыл бұрын

    Awesome :)

  • @user-mw5bm2xh9x
    @user-mw5bm2xh9x6 ай бұрын

    thanks for the video

  • @mohithp8700
    @mohithp8700 Жыл бұрын

    It was really useful I was doing challenges in leetcode and there are many challenges related to HOF You earned a subscriber

  • @ColorCodeio

    @ColorCodeio

    Жыл бұрын

    Awesome, thank you!

  • @chrisdietrich1533
    @chrisdietrich15332 жыл бұрын

    Thanks for another great video!

  • @ColorCodeio

    @ColorCodeio

    2 жыл бұрын

    You're welcome Chris

  • @averageguys_sa
    @averageguys_sa Жыл бұрын

    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

    @ColorCodeio

    Жыл бұрын

    Thanks and good luck with your studies!

  • @xpkareem
    @xpkareem2 жыл бұрын

    Helpful.

  • @scottbartlett6785
    @scottbartlett6785 Жыл бұрын

    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

    @ColorCodeio

    Жыл бұрын

    You’re speaking my language. Love lofi beats when coding 🎧

  • @Looneytune
    @Looneytune2 жыл бұрын

    You guys deserve way more attention.

  • @ColorCodeio

    @ColorCodeio

    2 жыл бұрын

    Thanks LooneyTune. Great name by the way 👍

  • @alialshaches6658
    @alialshaches66584 ай бұрын

    i love this dudes videos lol , good shit big dog

  • @davidmmadden
    @davidmmadden2 жыл бұрын

    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

    @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.

  • @jatilyadav4000
    @jatilyadav4000 Жыл бұрын

    Amazing and Informative as always .......Good luck

  • @ColorCodeio

    @ColorCodeio

    Жыл бұрын

    Thanks!

  • @mdshoharabpk1126
    @mdshoharabpk1126 Жыл бұрын

    thanks for your tutorial.

  • @ColorCodeio

    @ColorCodeio

    Жыл бұрын

    👍

  • @Danny-wu5ct
    @Danny-wu5ct Жыл бұрын

    THIS content is better than my bootcamp's content

  • @ColorCodeio

    @ColorCodeio

    Жыл бұрын

    Glad to hear it

  • @robertobenedit
    @robertobenedit Жыл бұрын

    Nice to discover you sir! fantastic tutorial

  • @ColorCodeio

    @ColorCodeio

    Жыл бұрын

    Thank you

  • @Pareshbpatel
    @Pareshbpatel10 ай бұрын

    The essentials of Higher Order Functions in JavaScript; so succinctly explained. Thanks, Sina {2023-06-21}

  • @longingbydesign
    @longingbydesign2 жыл бұрын

    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

    @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.

  • @genesipes8532
    @genesipes8532 Жыл бұрын

    Awesome show!

  • @ColorCodeio

    @ColorCodeio

    Жыл бұрын

    Thank you

  • @andrew.schaeffer4032
    @andrew.schaeffer4032 Жыл бұрын

    Great videos thank you. Just one thing I think could make them better would be if they were shorter/more concise.

  • @shaikhanuman8012
    @shaikhanuman8012 Жыл бұрын

    Thanks 🙏

  • @ibrahimyoussef4489
    @ibrahimyoussef4489 Жыл бұрын

    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

    @ColorCodeio

    Жыл бұрын

    Thank you

  • @Evildragonfirez
    @Evildragonfirez2 жыл бұрын

    Awesome Goodfellas reference

  • @ColorCodeio

    @ColorCodeio

    2 жыл бұрын

    🇮🇹🇺🇸

  • @psycodeveloper9001
    @psycodeveloper90012 жыл бұрын

    Why the hell don't you have more subscribers?? Your content is soo good... Loved it. Subscribing

  • @ColorCodeio

    @ColorCodeio

    2 жыл бұрын

    Thanks for subbing!

  • @KalenNorton
    @KalenNorton2 жыл бұрын

    Awesome 👏🏾

  • @ColorCodeio

    @ColorCodeio

    2 жыл бұрын

    Thank you brother Kato!

  • @leonnorlazami2304
    @leonnorlazami2304 Жыл бұрын

    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

    @ColorCodeio

    Жыл бұрын

    Build build build. That's the best way to learn.

  • @asauu4745
    @asauu47452 жыл бұрын

    guy deserves more subs!

  • @ColorCodeio

    @ColorCodeio

    2 жыл бұрын

    Ty!

  • @WineMusicWith
    @WineMusicWith4 ай бұрын

    still in love with background music:))))

  • @jasonlago5129
    @jasonlago512910 ай бұрын

    Youre the most underrated youtuber on the youtubes

  • @ColorCodeio

    @ColorCodeio

    10 ай бұрын

    Underrated comment! Thank you

  • @bob_bobsen
    @bob_bobsen Жыл бұрын

    nice clean background - great info on video

  • @ColorCodeio

    @ColorCodeio

    Жыл бұрын

    Thank you!

  • @chenzierkabrabam3060
    @chenzierkabrabam3060 Жыл бұрын

    The way you explain code is easier to understand. I request you to record a content about React stuff if possible. Happy coding.

  • @ColorCodeio

    @ColorCodeio

    Жыл бұрын

    Maybe soon

  • @techbro3085
    @techbro3085 Жыл бұрын

    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.

  • @abelmarkos5753
    @abelmarkos57532 жыл бұрын

    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

  • @saeed8641
    @saeed86412 жыл бұрын

    عاشقتم سینا . تو بهترین استاد جهانی بهت افتخار میکنم

  • @xv3lito378
    @xv3lito3782 жыл бұрын

    Great video! Very helpful. Also, I like your taste in films. Dark Knight and Goodfellas are great. ;)

  • @ColorCodeio

    @ColorCodeio

    2 жыл бұрын

    Haha thanks!

  • @dedmanraizd
    @dedmanraizd2 жыл бұрын

    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

    @ColorCodeio

    2 жыл бұрын

    Glad it helped!

  • @dedmanraizd

    @dedmanraizd

    2 жыл бұрын

    @@ColorCodeio Just to clarify, if a function by definition is what something does, how should we see primitive types as?

  • @tushar207
    @tushar2076 ай бұрын

    God level stuff!

  • @ColorCodeio

    @ColorCodeio

    6 ай бұрын

    God level comment

  • @tushar207

    @tushar207

    6 ай бұрын

    Thanks “STEVE”

  • @charlesfulnecky1974
    @charlesfulnecky19742 жыл бұрын

    Higher order functions FTW. Very handy in combination with Redux-Observable with or without React 😁

  • @ColorCodeio

    @ColorCodeio

    2 жыл бұрын

    Yes! The functional master has spoken!

  • @TheAcidMotion
    @TheAcidMotion2 жыл бұрын

    As usually, super informative episode. Funny too, just not sure how much joe pesci would agree there ;)

  • @ColorCodeio

    @ColorCodeio

    2 жыл бұрын

    Haha thanks dude!

  • @balighghaleb4021
    @balighghaleb4021 Жыл бұрын

    thanks alot

  • @ColorCodeio

    @ColorCodeio

    Жыл бұрын

    👍

  • @mohammadmirzaei9941
    @mohammadmirzaei9941 Жыл бұрын

    عالی بود ایول

  • @ColorCodeio

    @ColorCodeio

    Жыл бұрын

    Merci

  • @himabindhu4831
    @himabindhu4831Ай бұрын

    enjoyed learning!

  • @weibinren92
    @weibinren92 Жыл бұрын

    Could you also explain in more detail function factories?

  • @joshua_hc_cr
    @joshua_hc_cr Жыл бұрын

    Like the new studio, or old I dunno 😅😂 Thanks for the explanation.

  • @ColorCodeio

    @ColorCodeio

    Жыл бұрын

    🙏

  • @webdeveloper2769
    @webdeveloper27692 жыл бұрын

    he deserves 1 million subscribers

  • @ColorCodeio

    @ColorCodeio

    2 жыл бұрын

    Soon :)

  • @ataurahmandaudzai8198
    @ataurahmandaudzai81983 ай бұрын

    Thanks Dear So much Funny

  • @Vikram_Naik
    @Vikram_Naik7 ай бұрын

    ThankYou sir, May i know how to prepare those stunning animated ppt/slides...

  • @ColorCodeio

    @ColorCodeio

    7 ай бұрын

    I manually create the animations myself in Final Cut Pro and Apple Motion

  • @fernan007do
    @fernan007do Жыл бұрын

    éPICO MAN

  • @pharmacistbuilder
    @pharmacistbuilder Жыл бұрын

    finally someone i can understand

  • @ColorCodeio

    @ColorCodeio

    Жыл бұрын

    🙏

  • @kodnzikus
    @kodnzikus Жыл бұрын

    good stuff

  • @ColorCodeio

    @ColorCodeio

    Жыл бұрын

    🤘

  • @a-mok-youb
    @a-mok-youb Жыл бұрын

    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

    @ColorCodeio

    Жыл бұрын

    As long as function1 returns an integer I don’t see why not.

  • @Uri.Sab.
    @Uri.Sab. Жыл бұрын

    Do you have testing code videos?

  • @TheReadWellPodcast
    @TheReadWellPodcast Жыл бұрын

    I'm pretty sure you're the coolest programmer ever.

  • @ColorCodeio

    @ColorCodeio

    Жыл бұрын

    Haha I doubt it but thank you!

  • @samankushwaha6188
    @samankushwaha61882 ай бұрын

    function call stack is where i confuse all the time in HOF

  • @Rocker0jeda
    @Rocker0jeda3 ай бұрын

    Why so serious 😂😂😂, thank you for ur videos it helped me alooot.

  • @fluffybubble6872
    @fluffybubble68722 жыл бұрын

    This channel is soooo underestimated

  • @ColorCodeio

    @ColorCodeio

    2 жыл бұрын

    Thank you 🙏

  • @zero11010
    @zero11010 Жыл бұрын

    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.

  • @essaadi_elmehdi6784
    @essaadi_elmehdi67842 жыл бұрын

    That's great, also the quality is really high, even only the into can make u click the subscribe button.

  • @ColorCodeio

    @ColorCodeio

    2 жыл бұрын

    Haha thank you

  • @dan110024
    @dan1100243 ай бұрын

    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.