ความคิดเห็น •

  • @lolulol4
    @lolulol4 6 ปีที่แล้ว +160

    The syntax is not the only difference between arrow and regular functions. An arrow function does not create its own context, while regular ones do. This is something important to keep in mind.

    • @POGOLAUNCHER
      @POGOLAUNCHER 6 ปีที่แล้ว +4

      Yeah, same as .bind(this) on a normal function.

    • @TheCodingTrain
      @TheCodingTrain 6 ปีที่แล้ว +56

      Yes, this is key! Thank you for the comment. I wish I had mentioned this during the video. I do discuss this aspect in my arrow functions video. Will pin this comment so others see.

    • @lolulol4
      @lolulol4 6 ปีที่แล้ว +4

      POGOLAUNCHER while that is one of its benefits and gives somewhat of the same result, I wouldnt say it's exactly the same. It can also get you results you dont want

    • @guinwhite
      @guinwhite 4 ปีที่แล้ว

      Gotta keep those arrows out of object key-value statements that use "this"....right?

    • @adityadubey5204
      @adityadubey5204 3 ปีที่แล้ว +1

      but what does that actually mean?

  • @iTzJimBoi
    @iTzJimBoi 4 ปีที่แล้ว +17

    How you can remain engaged and ENGAGING throughout your videos is a skill I'm highly jealous of. You take a screen full of code and humanize it. I'm currently stuck in class trying to prove higher order functions work by rewriting them in our own words...and it's not fun. It's basically .filter() my joy out of my personal array. Your channel is a gushing spring river on a hot summer's day.

  • @keving6758
    @keving6758 4 ปีที่แล้ว +12

    his enthusiasm is what every other programmer needs on their tutorial videos. Literally if other people were like this, i would of learned java so much faster

  • @juanok2775
    @juanok2775 6 ปีที่แล้ว +22

    honestly your videos are awesome 20 mins tutorial feels like 5 mins... thanks!!

    • @guinwhite
      @guinwhite 4 ปีที่แล้ว

      especially when you watch them at 1.75 speed (like I do)

    • @adityadubey5204
      @adityadubey5204 3 ปีที่แล้ว

      so true I love the enthusiasms!

  • @jw7665
    @jw7665 5 ปีที่แล้ว +4

    Usually I have to speed the video up, but this time I slowed it down a bit lol. Dudes a ball of energy, makes a great teacher.

  • @zinsy23
    @zinsy23 4 ปีที่แล้ว +6

    I never knew programming could even be like this! This is incredible!

  • @Momosun2018
    @Momosun2018 4 ปีที่แล้ว +1

    "A function that expects a function as a parameter, creates a function and/or returns a function." - this did it for me. Thank you!!!

  • @percy888ferry
    @percy888ferry 6 ปีที่แล้ว +25

    You can take it even further:-
    const multiplier = factor => x => x*factor;
    although readability can suffer a bit.

    • @jkf16m96
      @jkf16m96 3 ปีที่แล้ว

      const multiplier = factor => number => number*factor;
      I think just changing "x" with "number" might be readable enough (unless the reader doesn't know arrow syntax).

    • @gabef9538
      @gabef9538 2 ปีที่แล้ว +1

      I'd can keep a set of curly braces around the inner function.

  • @neonhoshi
    @neonhoshi 2 ปีที่แล้ว

    Thank you for this video!!! I have read and read my lesson over and over, but after coding along with you it finally made sense!!!

  • @danielrodas7692
    @danielrodas7692 3 ปีที่แล้ว

    Wasn't too sure how higher order functions worked but came across this video and it explained it very clearly. Thank you!

  • @danilo86petrovic
    @danilo86petrovic ปีที่แล้ว

    This is the best explenation of higher order functions that i seen... Only now i understand it after so many watched tuturials... Thank you!!! 👍

  • @christopherholt3782
    @christopherholt3782 2 ปีที่แล้ว

    this guy has to be the most likeable person i've come across on YT

  • @jetspray3
    @jetspray3 3 ปีที่แล้ว

    Coding Train for clear concise explanation.

  • @human3rr0001
    @human3rr0001 4 ปีที่แล้ว +1

    You are so awesome to watch. I have a ton of fun and laugh a lot just tuning into your videos!

  • @Dylan_thebrand_slayer_Mulveiny
    @Dylan_thebrand_slayer_Mulveiny 5 ปีที่แล้ว +2

    What's crazy is you could also do
    const multiplier = factor => x => x * factor
    In fact, if you wanna get extra crazy, you can keep nesting the pattern as far as you want.
    I seriously love JS.

  • @katherinedragieva
    @katherinedragieva 4 ปีที่แล้ว +1

    You are a great teacher. I always come here when there's something I can't understand. :)

  • @santiagoramirez5507
    @santiagoramirez5507 3 ปีที่แล้ว

    The best coding teacher! Thank you so much!!

  • @RodrigoCastroAngelo
    @RodrigoCastroAngelo 6 ปีที่แล้ว +2

    That dab in 1:31 was flawless!
    Also, I don't remember where I saw it, something about functional programming I guess, but they had a similar example:
    You have a function multiply(a,b) with two argments.
    If you call multiply(2,3) it returns 6
    But you can also call multiply(2) which returns a function like that doubler, which multiplies to 2 whatever you pass in to it

    • @sadhlife
      @sadhlife 6 ปีที่แล้ว

      that was definitely not a dab tho :P

  • @cnsnmms3708
    @cnsnmms3708 4 ปีที่แล้ว

    Yes. An explanation should be like this.

  • @kopilkaiser8991
    @kopilkaiser8991 2 ปีที่แล้ว

    I enjoy watching your energy and interest in explaining programming logic. You have helped me understand this concept easier. I have tried reading many articles and forums for understanding Higher Order Functions but couldn't grasp the idea of it. But, you have helped me understand it better. Thank you so much for giving such efforts in explaining the complex ideas. Keep it up. I've subscribed to your channel to follow you regular.

  • @davidmcdougald6695
    @davidmcdougald6695 6 ปีที่แล้ว +1

    I finally subbed after this one. I finally understand whats going on with ES6 and callbacks.

  • @mistermomo2904
    @mistermomo2904 4 ปีที่แล้ว +2

    I'm still in high school, but i get the sensation that i'd learn more from this guy in 16 minutes than a professor in hours

    • @eatfrenchtoast
      @eatfrenchtoast 4 ปีที่แล้ว +1

      Behind all the TH-camrs and behind TH-cam itself are people that grinded it out in higher education. Don't get too high on the education bashing juice.

  • @WistrelChianti
    @WistrelChianti 2 ปีที่แล้ว

    Thanks I'm new to these arrows too so this has really helped!

  • @lukes5631
    @lukes5631 2 ปีที่แล้ว +1

    It crazy how entertaining you make coding. Your energy literally seeps through the screen.

    • @dgh25
      @dgh25 ปีที่แล้ว +1

      "literally"? Your screen is leaking?
      Did you mean "metaphorically"?

    • @lukes5631
      @lukes5631 ปีที่แล้ว

      @@dgh25 No. I mean literally because he is an exceptional and embodied communicator whose energy you can FEEL through the screen you dunkin' donut head.

  • @hugodelnegro
    @hugodelnegro 5 ปีที่แล้ว +1

    You are great, your entertaining skills while teaching are outstanding

  • @MalikJamazov
    @MalikJamazov 4 ปีที่แล้ว

    You are the best! You solve my questions about high-ordered functions!

  • @blusanders
    @blusanders 4 ปีที่แล้ว

    These are new to me and hard to wrap my brain around just yet but this is the best explanation thus far for me :) Thanks!

  • @techtronixweb7040
    @techtronixweb7040 6 ปีที่แล้ว

    I was a bit confused at first but you tied it all together nicely with the doubler tripler functions. Nice work.

  • @Locationary
    @Locationary 5 ปีที่แล้ว

    argh thank you so much for this video, explained it so much better then the current ebook I'm working off

  • @yavasel
    @yavasel 4 ปีที่แล้ว

    Hello, mate. Thank you very much. You are very good on this. This is the best coding video I have ever watched. I wish I could contribute you doneting this beautiful video but l lost my job 2 weeks ago because of covid.

  • @syedarmaghanhassan4652
    @syedarmaghanhassan4652 3 ปีที่แล้ว

    Thanks for sharing.
    Tip. 10:00. Don't lift your hand too much higher than the green-screen!

  • @rnmmakings4989
    @rnmmakings4989 10 หลายเดือนก่อน

    i really like your funny way and expressions to explain things.

  • @aayanguren
    @aayanguren 4 ปีที่แล้ว

    Honestly watching you make the same (minor) mistakes I make, makes me feel a lot better about my experience learning code. Except, I spend thirty minutes questioning everything I've learned studying functions, before realizing I forgot the second "i" in multiplier. "Like what the? I thought I understood this!!! What happened?!"

  • @Nyamistaya
    @Nyamistaya 6 ปีที่แล้ว

    Your videos are useful not only for javascript, i really appreciate

  • @joeekadi
    @joeekadi 3 ปีที่แล้ว

    Love your videos mate, super helpful and really enjoyable to watch. Thank you!

  • @setupdraw7642
    @setupdraw7642 6 ปีที่แล้ว +20

    Nice tutorial but I think it is not 100% clear (at least to me) how "x" argument is handled by the function; where the "x" parameter comes from (where it gets defined as a variable) and how it is passed in the factory function.

    • @Dylan_thebrand_slayer_Mulveiny
      @Dylan_thebrand_slayer_Mulveiny 5 ปีที่แล้ว

      It's basically inheritance. developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments

    • @4ipon4ik
      @4ipon4ik 4 ปีที่แล้ว +3

      function multiplier(factor){
      return x => x * factor;
      }
      let doubler = multiplier(2);
      // now doubler = x => x * 2;
      // so doubler(4) returns 4 * 2;
      // doubler assigned multipliers returned function

  • @darkthrongrising5470
    @darkthrongrising5470 6 ปีที่แล้ว

    Yours are the very best tutorials, you give really good quality education here, thank you very much sir.

  • @elgary9074
    @elgary9074 3 ปีที่แล้ว

    Thank you for this amazing explanation!

  • @ninglizhu2255
    @ninglizhu2255 5 ปีที่แล้ว +2

    still not easy for me to understand totally... but your video is great!

  • @mainlandbahr2176
    @mainlandbahr2176 3 ปีที่แล้ว

    How does the doubler(x) call work when there are no parenthesis holding parameters in the definition let doubler = mutiplier(2); I saw a comment below that mentions inheritance in JS, but I was still unable to make sense of this as it looks implied and not defined.

  • @fuzzylilpeach6591
    @fuzzylilpeach6591 6 ปีที่แล้ว +1

    OH MY GAWD IT MAKES SENSE NOW

  • @ErrorDebug
    @ErrorDebug 5 ปีที่แล้ว

    Hi thanks for your videos you are awesome healthy guy!
    I have one question cus i am a beginner, I see this first time, how can you pass a number into a variable 'doubler(4)' and that variable knows that you are referring to returned x parameter??? How and why it knows that, how is that linked?

  • @thedotisblack
    @thedotisblack 6 ปีที่แล้ว +1

    That's quite relevant... Especially since I always get headache from those higher order functions!! 🙃⚫
    Thanks for the video!

  • @ore_bear8045
    @ore_bear8045 4 ปีที่แล้ว

    thank you!, very well explained

  • @papii_6669
    @papii_6669 6 ปีที่แล้ว

    I learned this for swift a while ago, good video :)

  • @adamnorman85
    @adamnorman85 2 ปีที่แล้ว

    You're great as you always 😘

  • @ynotbutcher1891
    @ynotbutcher1891 5 ปีที่แล้ว

    you are very majectic the way you teach, bahaha it works!

  • @Weeb940
    @Weeb940 ปีที่แล้ว

    thank you so much for this toturiale

  • @Mari_Selalu_Berbuat_Kebaikan
    @Mari_Selalu_Berbuat_Kebaikan ปีที่แล้ว

    Let's always do good 🙏

  • @anmolagarwal5952
    @anmolagarwal5952 4 ปีที่แล้ว

    Do await and async use this higher order functions?

  • @stuffedpeanuts
    @stuffedpeanuts 2 ปีที่แล้ว

    Great tutorial

  • @konstantinkkk8397
    @konstantinkkk8397 4 ปีที่แล้ว

    does it higher order or destructuring? I cannot understand this code. Snippet where function return function
    function fluent(fn) {
    console.log(fn);
    return function (...args) {
    console.log(args);
    };
    }
    function Person() {}
    Person.prototype.setName = fluent(function (first, last) {
    this.first = first;
    this.last = last;
    });
    let Peter = new Person();
    console.log(Peter);
    Peter.setName("Peter", "Parker");

  • @ginalin310
    @ginalin310 5 ปีที่แล้ว

    soooo gladdd I find you

  • @乐易盎
    @乐易盎 5 ปีที่แล้ว

    I like your teaching

  • @fdj1966
    @fdj1966 3 ปีที่แล้ว

    thanks for the great video....

  • @frankrizzo5181
    @frankrizzo5181 4 ปีที่แล้ว

    I accidentally set the tripler factor to 4 and when changing it to three I got an error telling me identifier tripler had already been declared. It's a "let" declaration ......?

  • @gabef9538
    @gabef9538 2 ปีที่แล้ว

    This could do interesting things with optimization of damage calculations that include special effects being doubled.

  • @papinkelman7695
    @papinkelman7695 6 ปีที่แล้ว

    No diminishing return on the Coding Train.

  • @iandareopal
    @iandareopal 6 ปีที่แล้ว +3

    I do not understand what is being passed through as x in these examples, it seems as though you are only passing a value for factor.

    • @magdalenahlohovska1738
      @magdalenahlohovska1738 5 ปีที่แล้ว

      he sets the value for x when he calls the function in console

  • @darsh_shukla
    @darsh_shukla 4 ปีที่แล้ว

    Dan will you make a playlist separate for functional programming please

  • @amirulidzham3686
    @amirulidzham3686 5 ปีที่แล้ว

    The code executed is 4 x 2 right? not 2 x 4 isn't? at 15:10

  • @mekelilyasa9561
    @mekelilyasa9561 2 ปีที่แล้ว

    what is the different between closure and higher order function? newbie here

  • @Solsenderz
    @Solsenderz ปีที่แล้ว

    Well, I thought I could teach myself what is hof in the video, but instead, I'm more confused now, lol) definitely not for beginners, it's so fast to catch all of your ideas

  • @jakefreise7601
    @jakefreise7601 6 ปีที่แล้ว

    Do you have any plans on completing part 3 of the agario code challenge? Looking forward to it!

  • @CharlesGouin
    @CharlesGouin 6 ปีที่แล้ว

    We all love those good old factories.

  • @latostadaa
    @latostadaa 2 หลายเดือนก่อน

    Hello, i have a question: Why doubler's argument becomes the X on the multiplier function?
    If somebody could help me i would be grateful.

  • @amogus7
    @amogus7 3 ปีที่แล้ว

    Everything between () will recognise as function argument and will return as a constant variable

  • @trex283
    @trex283 5 ปีที่แล้ว

    What ide do you use for js programming?

  • @mortyjr2334
    @mortyjr2334 5 ปีที่แล้ว

    So is the arrow function like a lambda expression in Java?

  • @chrismanuel8993
    @chrismanuel8993 5 ปีที่แล้ว

    hey thanks for this!

  • @petsinyourhair
    @petsinyourhair 6 ปีที่แล้ว

    Correct me if I'm wrong, but usually this is called 'Closures' in JavaScript. I don't disagree that they are also higher order functions, but this concept isn't how it is usually refered to.

    • @sumantkanala
      @sumantkanala 6 ปีที่แล้ว

      Please watch the whole video.

    • @petsinyourhair
      @petsinyourhair 6 ปีที่แล้ว

      Sorry, I didn't ask anything. Not sure what you reply to...

    • @sumantkanala
      @sumantkanala 6 ปีที่แล้ว

      I'm not correcting you as you said earlier in your comment, just stating that the what you described is discussed if you watch the whole video.

    • @petsinyourhair
      @petsinyourhair 6 ปีที่แล้ว

      Your comment is very useful. I wouldn't have wished I wouldn't have had missed it.

  • @wreak3r
    @wreak3r 6 ปีที่แล้ว

    Also just in case you come across this syntax, you may call the multiplier function like so: multiplyer(2)(4) and get 8 as result.

  • @Suviiii69
    @Suviiii69 10 หลายเดือนก่อน

    😭🥺rll appreciate this viddddd

  • @brod515
    @brod515 5 ปีที่แล้ว

    Can get even more cryptic if you want... let multiplier = factor => x => x * factor;

  • @mssadewa
    @mssadewa 5 ปีที่แล้ว +1

    damn! I just subscribed and enjoy how you present this!

  • @ukaszczaja9400
    @ukaszczaja9400 5 ปีที่แล้ว +5

    If You haven't already, then try watching Daniel's videos in 1.5x speed (or even more). It's quite funny 😂.

  • @VimalKumar-dl5jb
    @VimalKumar-dl5jb 6 ปีที่แล้ว

    passing function to function or returning a function is called higher order function right

  • @angelcaru
    @angelcaru 5 ปีที่แล้ว

    11:30
    const multiplier = factor => x => x * factor;
    :)

  • @mightyocean411
    @mightyocean411 3 ปีที่แล้ว

    const multiplier = factor => x => x*factor, all in one line

  • @okoiful
    @okoiful 6 ปีที่แล้ว

    Awesome!!!! ive been waiting for stuff like this for a looong time!!! :) . can u pease do more functional programming stuff? thanks!!!!

  • @thebuildguy7
    @thebuildguy7 4 ปีที่แล้ว

    I would agree more if someone said the father of computer science has a youtube channel named "The Coding Train", rather than memorizing his name from my GK book in first grade.

  • @phantasmFES
    @phantasmFES 5 ปีที่แล้ว

    thank u so much for this video ^_^ u made it very entertaining

  • @emerson-sheaapril8555
    @emerson-sheaapril8555 6 ปีที่แล้ว

    like a couple others below I'm a little confused how JS knows to pass doubler or trippler to the x variable.

  • @denzelsugayan432
    @denzelsugayan432 3 ปีที่แล้ว

    i cant seem to process the code in the example at my vs code

  • @manu_prasadh
    @manu_prasadh 6 ปีที่แล้ว

    Thanks for this video

  • @JonatanEdOrtiz
    @JonatanEdOrtiz 4 ปีที่แล้ว

    Amazing

  • @mohammadalrefaai-games8034
    @mohammadalrefaai-games8034 4 ปีที่แล้ว

    thank u thank u thank u

  • @neddev2990
    @neddev2990 2 ปีที่แล้ว

    Clickety, click, click.... don't mind me. I'm getting stuff that i didn't understand before! great tutorial.

  • @ruuji.
    @ruuji. 5 ปีที่แล้ว

    So I tried shortening the whole thing up and came up with this:
    let add = addition => { return x => x + addition; }
    Same with multiple, just as an addition.

  • @juliancaste3914
    @juliancaste3914 5 ปีที่แล้ว

    awesome !! I really like this videos

  • @sumantkanala
    @sumantkanala 6 ปีที่แล้ว +9

    applying this to multiplier function itself, it looks like this: const multiplier = factor => x => x*factor

  • @syedarmaghanhassan4652
    @syedarmaghanhassan4652 3 ปีที่แล้ว

    please show us a useful example which we can't achieve without a higher order function!

  • @lucasteixeiranl4473
    @lucasteixeiranl4473 3 ปีที่แล้ว +1

    hahaha you are awesome!

  • @VimalKumar-dl5jb
    @VimalKumar-dl5jb 6 ปีที่แล้ว

    arrow function dont requried return value r we need to return the value

  • @vladthe_cat
    @vladthe_cat 4 ปีที่แล้ว

    I've done this in Lua

  • @saminchowdhury7995
    @saminchowdhury7995 4 ปีที่แล้ว +3

    7:25 me whenever I see food.

  • @pranavbhale9744
    @pranavbhale9744 6 ปีที่แล้ว

    Hello sir and viewer,
    Can u explain me how multiplier(3)(5) gives out 15
    ie. calling HOC( )( )

    • @attilatoth268
      @attilatoth268 5 ปีที่แล้ว +1

      Becasue multiplier(3) returns a function which you immediately call with the argument 5.

  • @rominatulli4243
    @rominatulli4243 6 ปีที่แล้ว

    I love your voice.

  • @aleksandrstaetskiy5687
    @aleksandrstaetskiy5687 5 ปีที่แล้ว

    Nice

  • @OfficialYunas
    @OfficialYunas 6 ปีที่แล้ว +9

    The arrow functions look like python lambdas

    • @michielarkema
      @michielarkema 5 ปีที่แล้ว +1

      Because it is lambda xd