When do you need "bind()"? Indirect vs Direct JavaScript Function Execution Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 พ.ย. 2024

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

  • @msvmanikantasrivishnu7788
    @msvmanikantasrivishnu7788 4 ปีที่แล้ว +20

    Max you are awesome.Your Knowledge and Brain is really powerful.

  • @marcus_leon
    @marcus_leon 4 ปีที่แล้ว +18

    I've been looking for a good explanation about the bind and function execution for quite some time, and I found it today on my favorite youtube channel. Thanks, Max. =)

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

    Have been searching for a practical explanation for bind for a long time. This one rocks. Subscribed!

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

    Your are great Max. Best explanation about bind so far 🔥🔥🔥

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

    Seriously... I haven't had listened to any tutor so far that can explain things this well. No wonder people call him web-guru. This video is all I needed to understand this concept.

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

    best explanation I've ever seen on the web. This clears things up a lot. Thank you so much!!

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

    Yesterday I finally understood why we need bind() and today I successfully used it for the first time myself with complete understanding what is going on. Thank you Max. You are a JS ninja

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

    Holy man! What a great explanation is such simple terms. I've read a few snippets on this topic and haven't found anything even close. This covers the "why" and "when" to use. Thnaks for sharing.

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

    You, sir, deserve a lot more than you currently have.

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

    Max, I had just finished the .bind() section of your JS course and was still feeling a bit confused on when to use it. I spent a day or so reading through the MDN doc, but not making much headway. Suddenly today, I see this video, and your explanation here really helped to cement the concept in my head! Thank you!

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

    Finally, bind() got bound to my mind. Thanks a lot, Max!

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

    Hervorragend erklärt Max, danke dafür! Dein React-Kurs auf Udemy hat mich hier hin geleitet.

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

    Very clear explanation! Whenever I need to refresh my memory, I always first check out your channel)

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

    Gerade heute in meine Notizen mit aufgenommen: "bind() recherchieren" und schwups lieg ich abends auf der Couch und dein Upload kommt als Push-Nachricht 👍 Danke!

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

      Das freut mich natürlich sehr :)

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

    The best explanation of 'bind' method in the world

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

    Great explanation!
    Maybe you should have mentioned the case when we don't use any arguments in bind and use an event.target inside function on which we called bind method?

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

    ALWAYS great stuff, Max! You're very much appreciated!

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

    Max, you are awesome. thanks for the idea and avoiding undefined problems when we call the function inside another function.

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

    Yeah bro, i did understand your exceptional taught, and it always got me! You're really good!

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

    That is the first time I have understood the use of bind, thank you.

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

    I've will hate, love, hate and love Max for the rest of my life: the toughest but most brilliant teacher ever. Just a note when Max returns the function it might be even more clear by returning the whole content of the setAsActiveHandler like so
    function setAsActiveHandler(goalId, event) {
    console.log(event);
    return function () {
    const selectedGoal = goals.find(g => g.id === goalId);
    activeGoalElement.textContent = selectedGoal.text;
    }
    }
    this way at the first pass from the init() function setAsActiveHandler will be saved as a ready to be executed function at the click event by the user.

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

    You are the most finely detailed instructor I know. Your lessons are never boring it's like you got some super power. Any chance you will ever do an updated laravel course? Php seems interesting and a good way of getting into the industry

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

      Thank you so much! Never say never but at the moment I don't have such plans, sorry.

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

    Nice explanation, i just follow the patern before, now i know the reason

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

    Congratz Max. It was an amazing lecture!!

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

      Thank you! 😃

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

    Thank you, this is excellent and easy to understand 👍

  • @عبدالقادرعبدالرحمنعبدالله

    Max, thank you so much for sharing this.

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

    Very clear explanation. Thank you Maximilian

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

    Thanks, Max. Very helpful

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

    Loving your Flutter course on Udemy right now!
    Currently following along with the deli meals app module.

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

    Max, you are the best teacher in the game ♠️

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

    Super! This is better than my work around.

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

    Amazing video! I finally understood the meaning of bind() and its usage

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

    Thankyou Sir, for to the point explanation.

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

    This is a great explanation of bind. Even though you only mentioned it in passing, it finally helped me understand the issue with "this" inside a function, why you would need "bind", and why arrow functions are so great.

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

    That was literally on point on what i was searching for, Are you sent by GOD??

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

    It seemed trivial at first, but then it got useful!

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

    Max, could you explain me, please. You used an anonymous function in an addEventListener like addEventListener('click', () => {calling another function}) - and to me it is a way clearly than using a method bind(). Particularly in case of referencing to 'this' object. In the lesson 8. Binding Class Method & Working with this of Chapter 10 - you implemented an expression addCartButton.addEventListener('click', this.addToCart.bind(this)); in the first time - I've learnt Java and Python.... but I don't remember subtleties like this one in those languages. My question is if both methods are completely interchangeable? Having watched your video I went to my code of the lesson and changed the line into addToCartButton.addEventListener('click', () => { this.addToCart() }); It works well as before. I don't see any differences so far. Thank you in advanced!

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

    Amazing tutorial Max!! Thanks 💙🙂

  • @luigis.3909
    @luigis.3909 4 ปีที่แล้ว

    Max my question is why we need an event listerner?
    I can modify the innerHtml with some like `Button Text`;
    and avoid to add event listerner to browser right?
    I buy your sveltejs course on udemy and it's very good!

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

    excellent explaination!

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

    Thanks you so much max...love from India

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

    Thank you Max! 🙂

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

    Max is a star.

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

    This was very helpful, thank you!

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

    Thank you for this awesome explanation 🏆

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

    Nice explanation, thanks

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

    Thanks a lot for this explanation.. Just great!

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

    Very helpful, thanks a lot!

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

    I love your videos guys!

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

    Nicely explained! Just a question! Can we just pass the goal object directly as an arg in setAsActiveHandler instead of its id, avoiding the find loop? Or there is a downside?

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

    Awesome, thanks for the clarification !
    Can I assume that the main purpose of anonymous function is to be a pointer to another function ? Or is it just one of their uses ? (Not sure if I made myself clear)

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

    Could I understand why is there a preference for arrow functions over bind?

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

    this reminds me of another question, what's the differences between appendChild() and innerHTML ? they both do the same things, aren't they ?

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

    Especially I would think the bind approach is little slower than anonymous function (because of extra function call - bind).

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

    Hi Max, I couldn't understand why you didn't use "this"keyword inside bind()

  • @9SMTM6
    @9SMTM6 4 ปีที่แล้ว

    With typescript last I checked bind did unfortunately not have the best of typing, add to that the need to provide a this context and I pretty much always use new defined (arrow) functions.

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

    I unserstood it now better than the episode on udemy 😂

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

    It would be awesome to have a video abkut the same but in React, I have tried to do it but with no much luck when it comew to understand it

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

    Thanks!

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

    Tell something about core JavaScript.. Dom.. expanding collapsible table row.. hasownproperty.. for .. foreach.. map.. filter.. search... Fetch.. post.. splice.. etc..
    Thanks 😊

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

      Get his udemy course

  • @逍遥游-x2x
    @逍遥游-x2x 4 ปีที่แล้ว

    I'm taking your JavaScript course, and indeed it is, bind () is really hard to understand.

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

    That was perfect explain

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

    Thanks boss.

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

    Wasn t it possibile to store the función in a variable and pass that as a second argument?

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

      @ChiKler true, i tried that on a piece of code I am writing and didn t work at all. Ibsolved that passing in an anonymous function as second argument

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

    Why the automatic subtitles are for dutch language? :0

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

    this was amazing. how can your brain hold so much information?

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

    That's awesome

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

    amzing!

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

    Need to update that subscribe count on intro cut

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

      Good point, we'll do so in the next weeks :)

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

    Insted of bind we could use apply and it takes an array. Thank you!

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

    Jonas schmedtmann Cousin.

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

    I didn't get source code bro........😌

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

    TIL

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

    Dude... get some sleep.

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

      I'm ok, thank you ;)