Hey gang, in this Object Oriented JavaScript tutorial I’ll explain what method chaining is, and how we can set this up to work by editing the return value of the methods inside our User class.
๐ฑโ๐ป Course Links:
– VS Code editor – https://code.visualstudio.com/
– GitHub repository (course files) – https://github.com/iamshaunjp/object-oriented-js
– JavaScript for Beginners – https://www.youtube.com/watch?v=qoSksQ4s_hg&list=PL4cUxeGkcC9i9Ae2D9Ee1RvylH38dKuET
๐ค Donate @ https://www.paypal.me/thenetninja
๐Find me on Udemy @ https://www.udemy.com/user/47fd83f6-5e4a-4e87-a0f0-519ac51f91b6/
๐พ Video thumbnail artwork by PixelSwish @ https://www.youtube.com/channel/UCGKSD3mitWl5UpMxZzaIrRA
Original source
26 responses to “Object Oriented JavaScript Tutorial #7 – Method Chaining”
they need to let us make classes with classes
this one was very confusing.
I think this is called magic โจ๐ง
Sexy!
Javascript class not supported old browser like operamini not a profesional
why dont we define the methods inside the constructor.Please explain
awesome tutorial with a nice example…thanks
I have tried it with my code – https://jsfiddle.net/jt100/toaj1fp5/5/ but is not working ๐
When you type return this,why is it that in the console the object does not show up,return this does return the object at the end doesn't it?
also make a detail video on static properties and how to make a property private in js..
What a tutorial, So addictive. Hats off . Thank you
thanks shaun for this nice playlist i really love your episodes <3
Wow, I've been using method chaining this whole time and didn't realize how easy it is to implement yourself. Thanks for the great explanation!
SWWWWAAAIIIING!
Very very helpful! Thank you
It is very helpful, you are the best!
Awesome!
Merci ๐
Great Job i cant wait for more !
I did enhance the code a little bit, I wonder if I could make a for loop and I was inspired by "and" function in browser object :
//add to User class
and(cb){
cb(this);
return this;
}
//useage
var user1 = new User('xxx@yyyy.com', 'bander');
user1.login().and(
function (user) {
for (var i = 0; i < 10; i++) {
user.updateScore()
}
}).logout();
Thank you so much Shaun!! i`m excited to see the rest, you cleared up so much
Its my Birthday ninja…. And you gave a Special Gift.. This Playlist.
Thank you!!!
great content as usual. One request though, can you teach about _proto_ and prototype in the future tutorials please.
This is awesome. It seems that what you tells us is a different JavaScript than what I have known of. The 'Class' looks very useful. Thanks a lot, Shaun! Good night!
hey Shaun, can you give me an example that when we will use this method chaining in our projects ? and what is the usage of it ?i mean aside of chaining methods what is the real purpose of using it ? how it can be useful to use it ?