Learn JavaScript CALLBACKS in 7 minutes! 🤙

Поділитися
Вставка
  • Опубліковано 1 січ 2025

КОМЕНТАРІ • 87

  • @BroCodez
    @BroCodez  Рік тому +32

    // callback = a function that is passed as an argument
    // to another function.
    // used to handle asynchronous operations:
    // 1. Reading a file
    // 2. Network requests
    // 3. Interacting with databases
    // "Hey, when you're done, call this next."
    hello(goodbye);
    function hello(callback){
    console.log("Hello!");
    callback();
    }
    function goodbye(){
    console.log("Goodbye!");
    }

    • @Blitz61wasd
      @Blitz61wasd Рік тому

      @BroCodez Django course please

    • @Blitz61wasd
      @Blitz61wasd Рік тому

      Bro i subscribed and liked can you make django course

    • @-_SleepAndEat_-
      @-_SleepAndEat_- 8 місяців тому

      Bro can you do Kali Linux ?

  • @1992daven
    @1992daven 11 місяців тому +56

    I love the way you explain. Those other youtubers had me lost.

    • @thatlastborn
      @thatlastborn 10 місяців тому

      Right!!!

    • @jimmyhaotran123
      @jimmyhaotran123 6 місяців тому

      exactly always got me lost when other youtubers keep on repeating something like, we put another function inside a function as a paramether and in the function block we call back to the function a callback function, that is why it is called a callback function. And then they continue on giving an example of either a function with another function as parameter, or array functions console logging the elements when iterating through the elements. Like why would console log be a callback function, they never explain, This video explains everything to me. Thanks!!!

  • @thatlastborn
    @thatlastborn 10 місяців тому +33

    Honestly callbacks really left me confused. This is by far the best explanation I’ve watched. Tysm ❤

  • @isaiahaguilera7973
    @isaiahaguilera7973 Рік тому +21

    Bro, this was the easiest explanation I've ever seen. Thank you!

  • @a1m4thah3d
    @a1m4thah3d 3 місяці тому +4

    Anytime I'm learning something new and struggling, I watch a BroCode video and walk away totally getting it. I LOVE how everything is clear and concise and not a lot of needless rambling.

  • @masterwitcher317
    @masterwitcher317 9 місяців тому +8

    I love how you explain complex topics like this. You really helps me a lot.

  • @vallunacoder.wecodetogether
    @vallunacoder.wecodetogether Рік тому +11

    Fell like I'm finally understanding js. Thanks BRO! Greetings from Colombia!

  • @saichaithrik7134
    @saichaithrik7134 9 місяців тому +3

    one of the greatest explanation i have ever seen

  • @r3dwulf3
    @r3dwulf3 7 місяців тому +2

    Finally, I understood this. The concept was very confusing when others tried to explain it, and this video made it very simple to understand. Thank you for breaking it down.

  • @3lirez
    @3lirez 7 місяців тому +2

    You explained this in the simplest way possible bro! Now I love the “Bro Code” Channel!

  • @piotrmazgaj
    @piotrmazgaj 4 місяці тому +2

    This is my seal. I have watched the entire video, understood it, and I can explain it in my own words, thus I have gained knowledge. This is my seal.

  • @mohitanand5646
    @mohitanand5646 6 місяців тому +1

    Thank you for those example codes. Those really help with understanding the concept in-and-out of the box.

  • @yashashvi5048
    @yashashvi5048 16 днів тому

    Man ur the goat no one explains like u do many thanks

  • @kunalpal6647
    @kunalpal6647 Рік тому +3

    Such a beautiful explanation, Bro...earned a sub!!

  • @SpeaksYourWord
    @SpeaksYourWord 6 місяців тому +1

    The only freaking madlad that never disappoints. Only one.

  • @KarthikRajaKasirajan
    @KarthikRajaKasirajan 25 днів тому

    Amazing, pretty simple explanation. Good stuff

  • @nononono-pw1tk
    @nononono-pw1tk Місяць тому

    the profile pic is on spot. you're a giga chad for this vid, i needed someone else to explain this to me cuz i could not understand it from my teacher, thx.

  • @usman_acts
    @usman_acts 11 місяців тому +1

    @BroCodez : an impressive way to teach...
    A lot to learn in just 7 minutes
    Love from Lahore, Pakistan

  • @anitamurphy2323
    @anitamurphy2323 11 місяців тому +1

    And i finally understand. Greetings from Ireland x

  • @Saquib-r4n
    @Saquib-r4n 4 місяці тому +1

    bro i am not understanding the callback since yesterday after ur explanation i m going to subscribe u ASAP!!

  • @jatinjain1082
    @jatinjain1082 Місяць тому

    Amazing Explanation . Thank you so much

  • @liamrichardson62
    @liamrichardson62 5 місяців тому

    THANK YOU SO MUCH😭. I really needed this⭐

  • @rameenana
    @rameenana 8 місяців тому

    This was very helpful mate. Thanks! Appreciate your work.

  • @ФёдорСёмочкин
    @ФёдорСёмочкин 8 місяців тому

    Your videos helped me understand JS although i have already watched a lot of videos on JS. Thanks Bro!

  • @juancruzsantillanmenendez4254
    @juancruzsantillanmenendez4254 Рік тому +1

    You're the best, love from argentina!!

  • @CHANDRASHEKARRAHCS
    @CHANDRASHEKARRAHCS 8 місяців тому

    liked the way u explained things so simple and clear keep posting
    💌

  • @vedantrawat4064
    @vedantrawat4064 8 місяців тому

    Thank You so much before this video I was not able to understand this concept , I am now able to understand better .... Pls provide more such informative videos like this... ❤

  • @Eldorbek-Yokubjonov
    @Eldorbek-Yokubjonov 9 місяців тому

    the most simple and human understandable explanation thanks bro code

  • @ashutoshsingh583
    @ashutoshsingh583 2 місяці тому

    best video on func callback thks man.

  • @sarabadr1376
    @sarabadr1376 11 місяців тому

    Thank you so much for making it so simple and understandable ❤

  • @suwaddy1566
    @suwaddy1566 7 місяців тому

    Thanks for explaining callback function.

  • @sridhararivazhagan1323
    @sridhararivazhagan1323 5 місяців тому

    Thanks for this wonderful explanations I understand this in easy way thanks bro🎉

  • @FindingFocus
    @FindingFocus 8 місяців тому

    this was the video that finally helped this click with me. thank you!!!

  • @flowdesigner
    @flowdesigner Місяць тому

    Dang! That was a good explanation!!!

  • @zeelrana3369
    @zeelrana3369 4 місяці тому

    Great explanation 👍

  • @jauerboo6526
    @jauerboo6526 10 місяців тому +1

    good explanation!

  • @zine-el-abidine
    @zine-el-abidine 3 місяці тому

    i got it, thank you your the best !

  • @andrews13
    @andrews13 16 днів тому

    You are the best!

  • @hasanatahmadzai9079
    @hasanatahmadzai9079 5 місяців тому

    Truely you're the best.

  • @ikki_nikoo
    @ikki_nikoo 5 місяців тому

    randomComment()
    // LOVE YOU BRO CODE THANKS YOU!

  • @brijeshkumarchavda
    @brijeshkumarchavda 4 місяці тому

    Thank you ❤

  • @rx808
    @rx808 Рік тому +1

    legend!!

  • @elzosantos1253
    @elzosantos1253 10 місяців тому +2

    Hi, okay, I want to congratulate you for this incredible work, where you share your knowledge. I want to ask a question about how I render the results of the code in the console, so I know how to do it with HTML

    • @gloryanoliefo
      @gloryanoliefo 8 місяців тому

      Add the relevant script tag in your HTML file and set the src to your javascript file, then go live from your vs code, then navigate to your console in your browser, you will see the changes rendered as you code.

  • @mohammadalsallal7977
    @mohammadalsallal7977 8 місяців тому

    this guy is insane

  • @johnnyenglish3867
    @johnnyenglish3867 Рік тому +2

    legend

  • @ColeHartman1
    @ColeHartman1 7 місяців тому

    One thing I believe could have been clarified is that callback() does not actually WAIT for the line of code above it to be done. If the line above is asynch, it will call callback() first.

  • @johnwayne8059
    @johnwayne8059 7 місяців тому

    What do you know about promises? Would be interesting to see something about it!

  • @deeplife9654
    @deeplife9654 9 днів тому

    we need call-back mechanism to ensure that one function is called after another function sequentially ?

  • @otisprogramming2437
    @otisprogramming2437 Місяць тому

    Simple explanation, however I found the example of setTimeout to be open to misinterpretation or a little misleading.
    If we invoke the callback goodbye after a setTimeout function, the callback would still be logged first. I think due to setTimeout using a callback itself which interacts with the event loop and event queue.

  • @girishph.9970
    @girishph.9970 10 місяців тому +1

    if you had explained it using the setTimeout function itself it would have been much easier to understand i think , but thankyou.

  • @jadad7296
    @jadad7296 Рік тому +3

    cool

  • @guilhermemanoel116
    @guilhermemanoel116 5 місяців тому

    Goat!

  • @abdoun8214
    @abdoun8214 10 місяців тому +3

    still confused.

  • @shauryasingh63
    @shauryasingh63 8 місяців тому

    Thanks Bro!!

  • @7calculus
    @7calculus 6 місяців тому +1

    But if you use the setTimeout, then even with callback, bye is displayed first.....what's happening here?

    • @LaughThyself
      @LaughThyself 2 місяці тому

      i think setTimeout will run only after callback is done, this is 3 mo idk if it helps still

  • @ArthurWM9
    @ArthurWM9 Рік тому +5

    So what's the difference between using a function as callback and just calling the function from inside the one which will take some time to finish?
    Wouldn't this accomplish the same thing?
    Thanks for the video!

    • @jesusjosemarthalaborin1014
      @jesusjosemarthalaborin1014 Рік тому +1

      I have the same question or is that even a callback function too?

    • @Shubh_R_M
      @Shubh_R_M Рік тому +5

      Both works same in most of the cases but there are some points to be consider:
      1 ) callback program flow is more controllable
      2 ) asynchronous operation execution for e.g in video goodbye is executing later if we write normal hello function and call goodbye function in hello function and after calling goodbye function write another code then if goodbye function takes time to execute then other code after goodbye call will also has time delay . which is not happen in call back case .
      HOPE THIS HELP : )

  • @alirezafarokhzadeh
    @alirezafarokhzadeh 13 годин тому

    hi,
    and thanks for your videoes, I have a question:
    why the folowing code didn't work correctly? and show "two" befor "one"
    one(two);
    function one(callback) {
    setTimeout(() => {
    console.log("One!");
    }, 4000);
    callback();
    }
    function two() {
    console.log("Two!");
    }

  • @kathikr9360
    @kathikr9360 9 місяців тому

    thank you

  • @Ajinkkyaa_naik
    @Ajinkkyaa_naik 4 дні тому

    Been banging my head over this since a week. LIke I understand the whole concept but always failing to put it into use. the creation is not coming to me automatically and organically. Any other ways I can improve writing callbacks? the difficulty I am having is the writing the whole thing in a correct order. I have seen many coders write this differently.

  • @Blitz61wasd
    @Blitz61wasd Рік тому +1

    Django course please

  • @spencersedano
    @spencersedano 7 місяців тому

    Thank you bro code

  • @SadidIslam27
    @SadidIslam27 Рік тому +1

    best

  • @jay70p
    @jay70p 8 днів тому

    is it AJAX ?

  • @sportsknowledge92
    @sportsknowledge92 11 місяців тому +1

    Hi bro code please make small small project using function object array

  • @lorieldesamito3998
    @lorieldesamito3998 8 місяців тому

    chad

  • @coding_stuff_uz
    @coding_stuff_uz Рік тому +4

    Bro Django please 🥲

  • @albertt755
    @albertt755 5 місяців тому

    This callback function seems complicated.

  • @raghabpandit2610
    @raghabpandit2610 Місяць тому

    if the world ever has international code organization type shi Bro Code should be the president of it

  • @tabaeimohamedamine9243
    @tabaeimohamedamine9243 2 місяці тому

  • @Theoublal
    @Theoublal Рік тому +1

    Bro react

  • @saliouseck7715
    @saliouseck7715 Рік тому +1

    HI BROCODE THANKS FOR THE VIDEOS WHERE CAN WE CONTACT YOU ?

  • @nahidhasan5607
    @nahidhasan5607 2 місяці тому

    nice explanation!

  • @divyaanshuagrawal3383
    @divyaanshuagrawal3383 5 місяців тому

    Thanks Bro!