• Saturday , 21 October 2017

javaScript Method chaining tutorial ( function chaining)

Code Canyon



We will learn how to jquery style chain functions ( Methods) using pure javaScript. in Jquery we can do $(‘.class’).addClass(‘new’).removeClass(‘old’). we can achive similar chaining using pure javascript.

Method chaining, also known as named parameter idiom, is a common syntax for invoking multiple method calls in object-oriented programming languages. Each method returns an object, allowing the calls to be chained together in a single statement without requiring variables to store the intermediate results.

javascript advance tutorials
javascript function chaining
jquery like function chaining
javascript how to chain functions
java script function chaining
method chaining
chaining module method calls
method cascading
ECMAScript 5
ECMAScript6

Original source

3d Ocean

Related Posts

33 Comments

  1. George Gunnee
    September 29, 2017 at 10:43

    Note the shorthand instead of "{add: add, substract: substract, print: print};" you can now write
    return {add, substract, print}; And thanks for this clear demonstration.

  2. Sirus Das
    September 29, 2017 at 10:43

    Hi, I liked your tutorial. Is there other way than just return{add:add, substract:st…} and why didn't you use new obj()??? Could you please guide me 🙂

  3. sandip das
    September 29, 2017 at 10:43

    very nice

  4. Vishnu Prasad
    September 29, 2017 at 10:43

    Very nice explanation.. hurray👏👏

  5. Rahul Marne
    September 29, 2017 at 10:43

    javaScript Method chaining tutorial ( function chaining) what you want to explain in this video did get it please tell me

  6. MrChubib0
    September 29, 2017 at 10:43

    this guy is on point! great teacher

  7. Sam Yappa
    September 29, 2017 at 10:43

    Hi, I have tried in my localhost, but i didn't get any console output, please guide me

  8. Nafees abbasi
    September 29, 2017 at 10:43

    very nice explanation.

  9. Web Pocetnik
    September 29, 2017 at 10:43

    You are very good at explaining things.

  10. System Daemon
    September 29, 2017 at 10:43

    why return "this" ?

  11. divyanshu pandey
    September 29, 2017 at 10:43

    Is it same like event chaining ? Kindly reply

  12. Deividas Onaitis
    September 29, 2017 at 10:43

    Thanks great explanation, easy to follow

  13. caring support group
    September 29, 2017 at 10:43

    You should learn vi!

  14. caring support group
    September 29, 2017 at 10:43

    in the first example what is the point of passing the argument if I is already available in the scope? is this just best practices?

  15. kem mrthappy
    September 29, 2017 at 10:43

    i must very interesting tutorials , you simply made it so easy to understand ,thanks a lot

  16. Adil Alam
    September 29, 2017 at 10:43

    really helpful, nice one

  17. Milan Knezevic
    September 29, 2017 at 10:43

    Can you make tutorial about functions that return functions?there is no videos like that, but it is something?isn't it?

  18. Steven Correia
    September 29, 2017 at 10:43

    are bhai substract nahi, Subtract 🙂

  19. Prashant Kumar
    September 29, 2017 at 10:43

    awesome sir..your advanced js tutorial

  20. Lucio Mollinedo
    September 29, 2017 at 10:43

    What if you wanna add error handling to that? Like what you do with promises with catch, in case one of the chain links failed?

  21. krishna kamal
    September 29, 2017 at 10:43

    This is very helpful, thanks for sharing your knowledge!

  22. inj rav
    September 29, 2017 at 10:43

    very very good example .
    Not only method chaining
    the example at the end is very useful for writing a class with private fields and public methods..

  23. DW
    September 29, 2017 at 10:43

    Great video. FYI, it's "subtract".

  24. Krishna Kamal mostwanted
    September 29, 2017 at 10:43

    thanks for a great tutorial..it completely makes sense for me ..

  25. Tanisha
    September 29, 2017 at 10:43

    Hi, Thank you for the wonderful video. Can you please share your jsFiddle link here.
    Thanks,

  26. Sheshagiri Pai
    September 29, 2017 at 10:43

    I have always added new when creating the object. How did you get away with removing the new at 10:08 Can you please elaborate. Thanks 🙂

  27. Tetsuya Kuroko
    September 29, 2017 at 10:43

    This was extremely useful. Thank you for the straighforward and great tutorial.

    😀

  28. Say Hong Tan
    September 29, 2017 at 10:43

    This is great! Illustrates Method Chaining clearly!

  29. xingwang ren
    September 29, 2017 at 10:43

    it seems that the returned object is nothing but bunch of functions,these bunch of functions share the out parameter i,they can modify this i and return the object itself,which was cool, thanks sith!

  30. jayaprakash kadapli
    September 29, 2017 at 10:43

    Very helpful. I am newbie to java script. Thanks for the video.

  31. Michael OBrien
    September 29, 2017 at 10:43

    Nicely done. A very good use of 12 minutes for beginning JS programmers.

  32. Andres Rivera
    September 29, 2017 at 10:43

    You don't create a closure, you use a closure because closure is a feature of the language.

  33. Tzetrik Oiand
    September 29, 2017 at 10:43

    Very informative video!

Leave A Comment

You must be logged in to post a comment.