javascript callback functions tutorial

Поділитися
Вставка
  • Опубліковано 11 гру 2024

КОМЕНТАРІ • 673

  • @matthewkane5652
    @matthewkane5652 5 років тому +108

    Thank you for explaining the "Why we use it". This often isn't explained and it definitely helps with understanding. Well done!

  • @traezeeofor
    @traezeeofor 4 роки тому +12

    Thanks so much for this.
    Currently learning Javascript on Codecademy and was hell of confused at the "HIGHER-ORDER FUNCTIONS
    , Functions as Parameters" section, but this clarified everything. I'm so grateful.
    I've previously favoured interactive learning of CodeCademy and FreeCodeCamp, but you've made me now look at video tutorials in a new light

  • @andrewferguson6901
    @andrewferguson6901 5 років тому +1

    This is exactly what I needed to understand how callbacks work. I'm doing a node tutorial that has anonymous callbacks defined in-line and i had no idea why you would go out of your way to make a function more complicated by writing a function around it. This clears it up SO much

  • @DavidWoodMusic
    @DavidWoodMusic 5 років тому +1

    This is the first video anyone and everyone should watch on this.
    So many videos go SO deep and complex without covering the basics that its almost impossible to learn.
    But you my friend.
    Are the best.

    • @Techsithtube
      @Techsithtube  5 років тому

      Thanks Rick for the nice comment

  • @Mikemillering1
    @Mikemillering1 6 років тому +2

    I have been trying to understand callbacks all day on various blogs and other videos and this is the first time it is making a lot of sense. Great video and explanation.

    • @Techsithtube
      @Techsithtube  6 років тому

      Glad you got it. Thanks for watching

  • @travisschnider
    @travisschnider 7 років тому +8

    This is the best description of callback functions I've seen in all the internet. ...and believe me I've searched far and wide. Thanks for breaking this down for us!

  • @rodwynnejones
    @rodwynnejones 7 років тому +11

    Thank you, thank you, thank you.....I thought i'd never understand "callback" function, I've watched a few videos on this subject and could not grasp it and nearly gave up........but now......Thank you again.

  • @SridTech
    @SridTech 4 роки тому +1

    Making it straight to the point. No BS.
    Now I'm confident in using callbacks eventually forever. Thank you.

    • @Techsithtube
      @Techsithtube  4 роки тому +1

      Thanks for watching Sridhar. I am glad that you will remember this forever, my job is done here. :)

  • @alekss.9991
    @alekss.9991 6 років тому +1

    Amazing, I had 3 hours of this on my class yesterday, couldn't understand a thing! Cristal clear after 15 mins of your tutorial, thanks a lot!

  • @RedEyedJedi
    @RedEyedJedi 5 років тому +4

    I love the way you correct the syntax errors but leave the word back spelled incorrectly. That's a true programmer haha

  • @rahulkumar-ot4ie
    @rahulkumar-ot4ie 6 років тому +1

    I liked the point when u say y we r doing this. Many channels wont explain it. But the most imp point is y we r using a particular technique

    • @Techsithtube
      @Techsithtube  6 років тому

      Thanks for watching Rahul. I am glad that you learn something! :)

  • @vitaquasus1120
    @vitaquasus1120 8 років тому +6

    Great example of callback, your calc function and callback really shows the reason for using callbacks.

  • @gautammalik6146
    @gautammalik6146 6 років тому +1

    Sorting example was just awesome...I am almost following your channel for more than a year and get the job also as a node is developer...all credit goes to you 😄....now planning to learn data structures and algorithms... could you please help where I can start using JavaScript... because most of the examples are in Java or other languages...I want to do it practically.... thanks again I am earning bread for my family because of your channel :)

    • @Techsithtube
      @Techsithtube  6 років тому

      I have started a new channel for data structures and interview related questions. It's interviewnest feel free to check it out

  • @tnduc91
    @tnduc91 7 років тому +1

    Excellent point man (y)
    The way you introduced callback satisfies the Open&Close principle in SOLID.
    The O stands for: Open for extensions but close for modification. We are able to extend function "calc" as much as we want, but should not modify it ;)
    Love your tutorial!!!

    • @Techsithtube
      @Techsithtube  7 років тому

      Excellent point. Thanks for sharing! :)

  • @and6sdf
    @and6sdf 3 роки тому

    after 3 hrs tried to figure out callback function, I found this video and help me understand how and why to use callback. thank you Sir.

  • @daukimngansgsu
    @daukimngansgsu 5 років тому

    Have spent days trying to understand the "callback", finally got it after watching your video. A huge, huge thank!

  • @dan-3268
    @dan-3268 5 років тому +6

    Whenever I'm about to watch your video I know that by the end of it I'll understand the concept I couldn't wrap my head around.
    Thank you, kind sir!
    PS. Thanks for taking time to brush up on your accent. Normally it's quite difficult to understand everything when the speaker has a strong accent. Have a nice day, kind sir!

  • @hughclarke8504
    @hughclarke8504 4 роки тому

    I am studying a course in JavaScript and they explained (call back function) but I was so confused after I was done, they made it seem so hard. Thank you for explaining, great JOB.

  • @abhilash8555
    @abhilash8555 5 років тому

    I'm a java developer with 5 years of experience in the technology and peripheral frameworks. I've recently started to mug into JS as our new requirements are all transitioning into it. As you can understand it's a new territory and the all these functions acting weirdly is mind numbing for a java guy. Thanks so much, your video helped me so much in understanding the core need for callbacks. Please make one on promises.

  • @kennybills
    @kennybills 8 років тому +4

    Best explanation I have found yet. You made callbacks very simple to understand. Thanks!

  • @gl3862
    @gl3862 5 років тому +47

    “just in case somebody pass a garbage”
    😂😂😂

    • @Techsithtube
      @Techsithtube  5 років тому +4

      :)

    • @ahmedboutaraa8771
      @ahmedboutaraa8771 5 років тому

      @@Techsithtube hhhh you are funny as hell you and i really enjoy your tutorials

    • @OMFGClare
      @OMFGClare 4 роки тому +5

      let garbage = function(trash) => {...};

    • @grantemerson5932
      @grantemerson5932 4 роки тому

      my favorite statement in the video

  • @StriverHamza
    @StriverHamza 5 років тому

    Thanks for such an excellent video on callbacks. I've read a lot and been through a few videos trying to grasp callbacks and it hasn't clicked in my head until I came across your video.

  • @JoberneNgambeneb
    @JoberneNgambeneb 7 років тому

    You're the best! I spent two nights trying to grasp this callback concept and ended up understanding little. You made my progress real. thick books aren't always good :(

  • @adwaiths5438
    @adwaiths5438 8 років тому +21

    Most valuable 15 mins of my day. Thanks! (y)

  • @CyberAbyss007
    @CyberAbyss007 7 років тому +3

    Thank you! Good video. So callback is just a placeholder when I want to be able to pass a function in to another function, then it acts as the function itself once we inject it in to the other function where we can substitute callback "in our minds" with the name of the function we passed in the code logic. Yay! I think I got it now!

  • @ZGGuesswho
    @ZGGuesswho 7 років тому +3

    Extremely good teaching. Argument caught, no error thrown.

  • @keith6293
    @keith6293 5 років тому

    For a short video, it was actually quite full of informations.
    Clear and concise so i appreciated it.
    I watched it in 1.5 speed but it looked like it was at normal speed, so it's good, you obviously take the time to explain clearly and pronounce every word correctly. Thanks a lot for that because sometimes people talk really too fast or don't bother pronouncing anything the right way and you end up losing a lot of informations!
    Thumb up (y)

    • @Techsithtube
      @Techsithtube  5 років тому +1

      Glad it helped, I think its very important to understand callbacks in JavaScript, no one should move forward without properly understanding it. Thanks for watching .

  • @zaidhaan
    @zaidhaan 8 років тому +16

    Hi there! your videos are very easy to understand and are all briefly explained, thankyou for making these videos! also I think it would be useful for you to create videos talking about the classes, constructors, and extending them in es6 because they seem to be also something which is going to be helpful at times. :)

    • @Techsithtube
      @Techsithtube  8 років тому +8

      I am going to create a tutorial on classes next.

  • @bishawjitkumardey2075
    @bishawjitkumardey2075 7 років тому +2

    been scratching my head trying to understand callbacks in java. thank you very much for such a nice relief!

  • @genjioto
    @genjioto 4 роки тому

    You actually teach these concepts very well. My bootcamp does a horrible job of explaining these functional programming concepts.

  • @maximos118
    @maximos118 5 років тому

    Out of all of the videos on youtube, it's this one that gave me the eureka moment. I was very familiar with using callback functions in this way: someVar.addEventListener('click', () => {callback}) but creating a callback as a parameter for another named function really threw me off. Reall well explained. Thanks dude!

  • @singsarav
    @singsarav 8 років тому

    You are teaching many valueable javascript lessons in a easy way. Your free service is highly appreciated. We were really dummies before we look at your lessons.

    • @Techsithtube
      @Techsithtube  8 років тому

      Thank you! Do let me know if you want certain topics covered.

    • @singsarav
      @singsarav 8 років тому

      Recently interviewers have asked stunning questions which I didn't expect.
      1) How do u handle cache
      2) How do u handle offline when DB disconnected, still my application should survive with offline data downloaded previously, once DB is connected then it should handshake and continue as normal
      3) Handling Threads in Javascript when server need more time to process and send results to the client
      4) minification of js. Is it so important? Usually ignore that
      5) Versioning management in javascript. Is it so important? Usually ignore that
      6) Unit testing in javasciprt
      Other than these broadly lot of client side frameworks need to learn. (AngularJS, Backbone JS, Ember JS, Node JS, Require JS, Polymer, Handlebar, etc).

    • @Techsithtube
      @Techsithtube  8 років тому +1

      All the really good topics.
      1) Handling cache
      You can do something like this in your html
      scr="myJs.js?121212"
      basically add a new number every time your deploy. There is a good solution using gulp . I will create a tutorial on that.
      2) How to handle offline ( there are multiple solution to this. If you are using a JS platform you can use their technique. for exmaple if you are using ember.js you can use ember data. I will have to create a tutorial on that.
      3) for handling the Threads in Javascript ( I have a tutorial on that ua-cam.com/video/pMK-jcOAYI8/v-deo.html)
      4) minification.js it is important depending on your application and number of users. Tell me the size of your application and number of people involved. there is a gulp solution which is very easy to implement)
      5) Which versioning management are you referring to ?
      6) Unit testing is very important, however this again depends on the size of your application . If you are using a javascript platform, versioning comes with it so you can use it there . I will make a tutorial on that.
      I am going to start Angular2 and EmberJs tutorials really soon. Angular2 is the latest platform and a very important one. EmberJs would cover handlebar as well. I am also thinking about polymer. If you are learning a new platform i would suggest that dont learn AngularJs1( this was the first version and going away soon) and Backbone.

    • @Techsithtube
      @Techsithtube  8 років тому

      3) Unfortunately JavaScript is single threaded. even using WebWorker is not multi threaded. This might change in the future.
      4) Use npm and bower to solve the version issue. if client modifys the code and mixes dependancy. this would become their issue. You should be clear on how to install and if they are going to mix , they should let you know in advanceed.
      6) Backbone is still used but not many people choosing it for new apps. I think if you have a simple project you can still use it .

  • @gustavomonte6672
    @gustavomonte6672 4 роки тому

    The only one to come up with a simple and straightforward example of callback functions. Thanks!

  • @lindseyr1845
    @lindseyr1845 8 років тому +1

    This was a simple and clear explanation! I finally understand callback functions. Thanks for making this!!

  • @vaitalaziz100
    @vaitalaziz100 8 років тому +21

    Really u have explained very simply & smart way that anyone can catch it clearly and easily. Great job. Carry on and good luck for the next tutorials ;)

    • @williamjamesrapp7356
      @williamjamesrapp7356 4 роки тому

      NOT ANYONE , I am the type person that does not understand ABSTRACT information and then can be expected to apply it to a real world situation. I have no idea what he was talking about and I have watch SO MANY JS videos I cant even count them. I understand HTML, CSS, PHP, SQL but I have yet to see a JS video where they apply it in a real world scenario all of this abstract language means nothing to me. ALTHOUGH, I am happy for you that it all makes sense. I just wish I could find a video that would TEACH JS in actual usage and not in abstract techno information.

  • @muhammadwaqas-zt7xl
    @muhammadwaqas-zt7xl 8 років тому +1

    i am learning JS just from your tutorial and and you explanation is good God bless you Thank you

  • @MosesJeromeCLucas
    @MosesJeromeCLucas 6 років тому +1

    your second example just made me realize callbacks are could be more. Keep it up

  • @MsCrusifix
    @MsCrusifix 6 років тому

    i have been following your tutorials from some time and really wanted say thank you for ths wonderful job. not all got the capability to make others understand in a simple and precise way. again thank you

  • @jasongifford6851
    @jasongifford6851 7 років тому

    You deserve a quieter place to live and thank you for the great content!

    • @Techsithtube
      @Techsithtube  7 років тому

      Jason , you noticed :) Since that video , i do have a semi private bit more quieter place. :)

  • @mahajanravish
    @mahajanravish 6 років тому +11

    after roaming months on youtube finally i found this 😊

    • @Techsithtube
      @Techsithtube  6 років тому +4

      I am glad you found it. Thanks for watching Ravish!

  • @GVAlenero
    @GVAlenero 7 років тому +1

    Thanks for clearing that up. I've been using it but never had a clue what call back was. The term always confused me.

  • @prathameshmali3888
    @prathameshmali3888 4 роки тому

    I've been struggling for many hours finally understand callbacks. Thanks sir.

  • @JagadeeshVadranapu
    @JagadeeshVadranapu 8 років тому +4

    amazing , i used callback functions but i couldn't explain to others , from now i will explain callback functions

  • @brianhooks125
    @brianhooks125 5 років тому +1

    I have learnt so much on this video, I learnt to call back, grave accent instead of using + at all times and finally I learnt typeof , you're awesome keep up the good work

  • @Nexus2UAll
    @Nexus2UAll 7 років тому

    Previous comment didn't show up!
    Here goes nothing:
    Thanks pal! Made that simple to understand for a beginner like me (unlike so many geeky explanations).

    • @Techsithtube
      @Techsithtube  7 років тому

      I am glad it helped. Thanks for watching!

  • @AgeelShatry
    @AgeelShatry 7 років тому +2

    At the 7:57 mark, I don't get how callback is linked to the add and multiply functions. Can you please elaborate? Thanks in advance.

    • @Techsithtube
      @Techsithtube  7 років тому +5

      add and multiply functions are passed as an argument. to calculate function and inside the calculate function the argument is executed.

  • @roksimilijan
    @roksimilijan 7 років тому +3

    Thanks man! This tutorial made me understand callback functions. Great way to explain essence of this JavaScript part :)

  • @abuhurayraratul5530
    @abuhurayraratul5530 3 роки тому

    Great example of callback. Thanks man! This tutorial made me understand callback functions. Finally
    a well explained video about callback functions. It's hard to find nowadays.

  • @GraceandWisdom
    @GraceandWisdom 4 роки тому

    Thanks techsith! This definitely cleared up what it means to callback a function. Sir, You are AWESOME!

    • @Techsithtube
      @Techsithtube  4 роки тому

      You are most welcome! When started learning JavaScript, callback function was so confusing. Once you know callbacks lot of thinks openup

  • @amagdziarek1689
    @amagdziarek1689 7 років тому +13

    Hey, thanks for this, it's a very easy to understand explanation, I appreciate it!

  • @Loficomposer
    @Loficomposer 5 років тому

    this examples make more sense for me cuz usually an=m not that gd with callbacks bt now am more comfortable with it thank you man

  • @viery3654
    @viery3654 8 років тому +1

    Thank you! Finally a well explained video about callback functions. It's hard to find nowadays.

  • @lplln
    @lplln 7 років тому +1

    The clearest description ever :) thank u!

  • @CamiloLucero
    @CamiloLucero 5 років тому

    Very well explained. As a correction @0:08, they are not the same: higher-order functions are functions that take another function as an argument, that argument is the callback function.

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

    Thank you so much! I learn a lot. I see that you are not uploading videos, you must return and teach the next generation. You are a great teacher!

  • @santhoshdevaraj8697
    @santhoshdevaraj8697 8 років тому +36

    Door knock @ 2:07...Seems somebody at home is not happy ;)

    • @gabovanlugo
      @gabovanlugo 8 років тому

      Twitch Style, lol :P

    • @dipteshmukherjee346
      @dipteshmukherjee346 7 років тому

      yes i too heard that

    • @jyotilondhe259
      @jyotilondhe259 7 років тому +41

      she didnt understod callbacks

    • @jasperzanjani
      @jasperzanjani 6 років тому +14

      his wife heard "callback" and she said "who the fuck are you calling he, your side bitch?"

    • @levatruskavec2199
      @levatruskavec2199 6 років тому

      ааааа ! Спасибо пасоны , угарнул ! )))
      автору респект, хорошее ввод в колбэк функции.

  • @RahulGupta-km7nm
    @RahulGupta-km7nm 7 років тому

    At 9:10, how the numbers are printed using '$' symbol? Is there any library included or simple Javascript on line 10 of code?

    • @Techsithtube
      @Techsithtube  7 років тому +1

      its called template string. it was introduced in javaScript few years so go as part of the new version ES6/ES2015 .

  • @Nexus2UAll
    @Nexus2UAll 7 років тому

    Thanks mate! Very clear and simple to understand for a beginner like me. Had trouble finding a non-geeky explanation and you did the job nicely.
    All the best! :)

    • @Techsithtube
      @Techsithtube  7 років тому

      I am glad it helped. Thanks for watching ! :)

  • @yousifalmayyahi4462
    @yousifalmayyahi4462 6 років тому +1

    what you have done in this video is really wonderful and useful .
    i hope all the best for you dude , keep going , all the best

    • @Techsithtube
      @Techsithtube  6 років тому

      Thanks for watching :) keep learning!

  • @krishnareddyrenabothu1409
    @krishnareddyrenabothu1409 7 років тому +1

    My confusion got cleared, more detailed, Thanks very Much

  • @sirbruce5978
    @sirbruce5978 4 роки тому

    I am new to programming.
    If you were to add two more parameters to the add and mult functions--num1, num2, num3, num4--would you still be able to add just two numbers if you wanted to?
    Also, how would you write the parameters so you could add as many numbers as you wanted to? ex. 1+2+3+4+5+6+7+8
    thank you

    • @Techsithtube
      @Techsithtube  4 роки тому

      yes you can write a function that do that . here is an example codepen.io/codepatel/pen/wvGgwjz?editors=0012

    • @sirbruce5978
      @sirbruce5978 4 роки тому

      @@Techsithtube thank you

  • @rfbu
    @rfbu 7 років тому +2

    just want to say it has been well delivered and well prepared.

  • @harisbjelic9026
    @harisbjelic9026 7 років тому +14

    You're a hero! Thanks for this great tutorial!

  • @sanfordhoffman2392
    @sanfordhoffman2392 7 років тому +1

    I liked your video. You do a great job describing callback functions. It's crystal clear to me now what it is. In C# they are called delegates.

  • @kartikisahu4938
    @kartikisahu4938 5 років тому +2

    You are really awesome. I just love the way you explain complex concepts.

  • @jrb65
    @jrb65 3 роки тому +1

    one of the best explanations for callback function

  • @rajabmuhamedrajab5128
    @rajabmuhamedrajab5128 4 роки тому +2

    Thank You , I ' am Understand callback function you are great

  • @TheRonakagrawal
    @TheRonakagrawal 7 років тому +1

    finally a great explanation with the WHY aspect!. Thank you Sir.!

  • @Slarti
    @Slarti 7 років тому

    Thanks for the explanation - very clearly explained.
    I have question though - if you have a pattern like this:
    if (a === 1){
    return "Hello world 1";
    }
    else {
    return "Hello world 2";
    }
    Why not just code:
    if (a === 1){
    return "Hello world 1";}
    return "Hello world 2";
    As the else is unnecessary due to the first return causing flow to break out if it evaluates as true so an else in not needed?

  • @TheDogn
    @TheDogn 7 років тому

    I have a several unique functions capable of returning a number from a range randomly, where the type of range is what makes them unique. I have need to test the outputs of these functions to ensure certain eventualities are impossible. So I have written a function:
    function cbTestFor(callback, n){ /* while loop */ }
    It returns a string stating the number of iterations it took for `callback` to produce `n`. When the browser stalls I know `n` can not be produced by the function. It's crude I know, but it works.
    since sometimes the callback function I need to test takes parameters, I need a way to pass those through only when necessary, while otherwise not being required to pass them.

    • @Techsithtube
      @Techsithtube  7 років тому

      what is this callback|10|7 ?

    • @TheDogn
      @TheDogn 7 років тому

      It's just an example. I was asking if anything LIKE it was possible. I've modified my original question to be less confusing

  • @displayblock6696
    @displayblock6696 7 років тому

    what i want is to arrange the videos from beginning to end. i mean if this is the first time i visit techsith youtube channel i wanna find like directory which shows to me the arrangement that i should follow from the beginning to the end :)

    • @Techsithtube
      @Techsithtube  7 років тому +1

      I have created a playlist for you where i have arranged videos in that order. Let me know what you think.
      ua-cam.com/play/PL7pEw9n3GkoUyw6qAFlX29Bfci0uRm-Gu.html

    • @displayblock6696
      @displayblock6696 7 років тому

      Thank you so much ❤️❤️❤️❤️. i will follow this arrangement but please complete it because i see in your channel a lot of videos but this playlist that you created ua-cam.com/play/PL7pEw9n3GkoUyw6qAFlX29Bfci0uRm-Gu.html just has 12 videos i want all of the JavaScript videos in your channel arranged from the beginning in one playlist to follow it. Thank you so much my teacher ❤️❤️❤️❤️❤️❤️❤️❤️

  • @malikabdullah7510
    @malikabdullah7510 4 роки тому +4

    taught me something in 2020 ❤️❤️

  • @ericnguyen23
    @ericnguyen23 6 років тому

    Very clear in explanation. This is the first video I've watched from you but plan on watching a lot more!

    • @Techsithtube
      @Techsithtube  6 років тому

      Welcome Eric, let me know if you want me cover specific topic. Thanks for watching! :)

  • @rvalenta4
    @rvalenta4 6 років тому +1

    Very helpful, I'm using this to revise before an interview.

  • @pleabargain
    @pleabargain 7 років тому

    8:40 that is babeljs yes? ecma 2015? use of $?

    • @Techsithtube
      @Techsithtube  7 років тому +1

      its ECMA 2015 use of ${} is called template strings.

  • @AhmedVlogs1
    @AhmedVlogs1 6 років тому

    Finally understood callback...after watching this video...thanks a Lot

  • @zaziefarmer8214
    @zaziefarmer8214 8 років тому +1

    this is such a life saver video! your video is so easy to understand! thank you so much!!!!

  • @kevinadrian2640
    @kevinadrian2640 3 роки тому

    Thanks, its really the best explanation for callback functions - i watched a few videos and didnt get it till yet

  • @arkhamian7586
    @arkhamian7586 4 роки тому

    You explained "Why" we use them rather than just "How" (which is less significant). Thank you.

  • @julianstorm7722
    @julianstorm7722 4 роки тому

    Thanks heaps. Straight to the point, clear and easy to follow. Been struggling with the instructions given on codeacademy on this very topic. Thumbs up mate.

  • @nanchussss
    @nanchussss 2 роки тому

    The best explanation i have found so far. Really good thankyou so much!!!

  • @adamfadhil5193
    @adamfadhil5193 7 років тому +1

    After writing node application for one year, i now understand what a callback is

    • @Techsithtube
      @Techsithtube  7 років тому +1

      Wow. Node is all callbacks.. that happens. :)

  • @jamesmoreau6832
    @jamesmoreau6832 6 років тому

    Thanks for sharing. Callbacks have been driving me up the wall.

    • @Techsithtube
      @Techsithtube  6 років тому

      I am glad that it cleared up the concept of callbacks. :)

  • @TheWolfPackFam
    @TheWolfPackFam 7 років тому

    What an awesome video!! I actually understand functions after watching several videos.

  • @jaredcave1488
    @jaredcave1488 4 роки тому

    I've really struggled to understand callback functions and I'm still not 100% but this video really helped! Thanks

  • @majia
    @majia 7 років тому +1

    Thank you so much, you gave such a clear and easy to follow explanation of callback functions.

  • @centaur26
    @centaur26 3 роки тому

    I really like the way to teach stuff, its comprehensive and clear, thanks for taking time to make these videos.

  • @finkygsd2720
    @finkygsd2720 7 років тому +1

    finally someone explained callbacks! thanks!

  • @brettm9
    @brettm9 6 років тому

    I really understand these mysterious functions now! Thank you for de-mystifying them.

  • @prernasingh7783
    @prernasingh7783 6 років тому

    your video has made call backs so simple for me!!! Thanks in tonnes ..

    • @Techsithtube
      @Techsithtube  6 років тому

      I am glad that you learnt Prerna. Thanks for watching! :)

  • @ramazankhan5930
    @ramazankhan5930 4 роки тому

    Dude. Never knew you can do that. Awesome. Keep it up. If no one likes it people like me would like it.👍🏼

    • @Techsithtube
      @Techsithtube  4 роки тому

      Ramazan, I really appreciate the like , thank you!

  • @dialecticalmonist3405
    @dialecticalmonist3405 2 роки тому

    So, it seems to be a way of creating abstractions?
    Whereas in other languages, one would create an "abstract function" or "interface".
    Does that sound right, or no?

  • @prasannanaik1023
    @prasannanaik1023 4 роки тому

    Most important he explained when exactly it is useful! Thanks

  • @manojv4449
    @manojv4449 6 років тому +1

    this is the best video so far i watched

  • @piroozpakdel9415
    @piroozpakdel9415 7 років тому

    great video lesson. Thank you.
    just out of curiosity what were the -1 and 1 you were returning (for IF and else respectively) in the last segment of the lesson where you sorted the array based on an anonymous function?

    • @Techsithtube
      @Techsithtube  7 років тому +1

      the returning -1 or 1 decides the order it will sort for that particular field.

  • @alexmasinde7847
    @alexmasinde7847 5 років тому +1

    Thank you, I now have a good understanding of callback functions

  • @sujeetagrahari2292
    @sujeetagrahari2292 5 років тому

    Callback is a function which is passed to another FUNCTION and it will be executed at SOME POINT when the FUNCTION 's execution has finished.
    Why not just after the FUNCTION'S execution, but after some point? Because it depends on the execution stack, if it's empty ,callback will be executed immediately after FUNCTION's execution and there is no other task in message queue.
    This is what makes callback non-blocking.
    Take it this way, I have some code that needs to be executed . But before this code I have some other code which is time taking maybe API calls, some other processing that can take time. Okay, what is the problem? Problem is JavaScript is single threaded and it runs code in synchronous way.
    We don't execute this piece of code immediately but we pass it to WEB API. What WEB API does it process the task in the background, making the API CALL, and attaches the callback as an event handler that will be executed when the process is finished.
    What will happen then?
    After the process finishes, it push the callback to the message queue. Where this callback waits to be executed once the execution stack is empty.
    Who determines that ,EVENT LOOP. Once the execution stack is empty it will process the message queue.

  • @devendradeo5833
    @devendradeo5833 3 роки тому +1

    just loved the explanation, thank you sir.

    • @Techsithtube
      @Techsithtube  3 роки тому

      Devendra, thanks for the comment! Keep on learning!

  • @GameTime-ze8gq
    @GameTime-ze8gq 5 років тому

    Thanks for making it simple. Although i am having doubt. Instead of passing callbavk function. We could have call add and multiply function inside calc function
    So how it is different to call callback function instead of calling function directly.
    Can you please explain it?

    • @dialecticalmonist3405
      @dialecticalmonist3405 2 роки тому

      I think it's a way of creating abstractions.
      Javascript doesn't have "abstract" or "interface" functions.
      Passing a function as a parameter seems to be the way they handle it.

  • @martinbozinovski
    @martinbozinovski 5 років тому +2

    Such a good explanation. Good work man ;)