Комментарии:
Thanks for creating such an awesome video!!!!!
ОтветитьHi Kyle, good stuff, your videos are always a guarantee of learning something effectively.
There are 2 things I still don't understand.
1_ difference between 'new' and 'Object.create()
2_ if I create a function in the constructor I can access that from any instance of the constructor:
function Bear(kind) {
this.kind = kind;
this.growl = function() {
console.log('grrr');
}
}
var polar = new Bear('polar');
polar.growl() // -> 'grrr'
What am I missing?
Cheers, Giovanni
You could also use new Bear() instead of Object.create(Bear.prototype)
ОтветитьIn JavaScript, Its always Prototypal under the hood, because objects share properties through their prototype property.
The way of doing this inheritance showed in this video is not Prototypal, its Classical.
Can you share your gulp/grunt script to live reload?
ОтветитьKyle, thanks for the great tutorial. I have a question, wondering if you can answer...you are doing
Grizzly.prototype = Object.create(Bear.prototype)
1) Can I do this instead? Grizzly.prototype = new Bear(); If so, what are the differences. Thanks
great video
ОтветитьVery brief but spot on! Very clearly explained! Great job!
Ответитьhello, Kyle! thanks for the video, but I can't get the one difference (sorry, If I repeat the topic, I haven't find the same question): is there any difference between assigning properties/methods via prorotype where all instances will inherit all the properties and just adding that same properties/methods to the 'class' himself where all instances via 'new' will inherit all the properties!
hah, is there?:) thanks!
and probably you cound use Grizzly.prototype = bear to inherit bear object's properities, right?
This was absolutely fantastic and incredibly concise thank you sir!
ОтветитьAwesome explanation! But there's something I don't understand. While inheriting, if we use
Grizzly.prototype = new Bear(); , you do not need the line to call the parent constructor // Bear.call(this); to inherit parent's member funcs and vars.
However u need it when doing Grizzly.prorotype = Object.create(Bear.prototype);
So what is the difference ?
Also when u use the former way to inherit, it truly inherits everything from parent. Everything declared in the constructor too(not just the ones in the parent's prototype). But when you use the latter way without the line (Bear.call(this);) it only inherits the vars in the parent's prototype, not the vars and funcs in the actual Parent constructor. As soon as you include (Bear.call(this)) you have access to everything in the constructor too. What is this behavior. Could you please explain that ?
Interesting concept, I wonder why JavaScript is the only language to implement object oriented programming that way ! Also, what would happen if you didn't use object.create and instead passed the bear prototype as the grizzly prototype ? doest that mean that if you change the grizzly prototype its parent prototype will be modified too ? thanks for sharing the knowledge btw 😂😂
ОтветитьHow do you comment out lines so fast?
ОтветитьThis is basic inheritance not prototypal?
Ответитьawesome tutorial
ОтветитьHey Kyle, you did a very good video! Many Thanks for sharing it !!!
ОтветитьHold on.... I'm a bit confused... I thought with Prototype Inheritance you don't use the new keyward to instanciate an object.... I thought now its Object.create({ property:value}) for inhertiance.... I think this is classical inheritence. so confused.
Ответитьdo you have to set the constructor of Grizzly again by Grizzly.prototype.constructor = Grizzly.prototype?
Ответитьinsta sub
ОтветитьI had to log in to my google account just to say thank you for this well explained video... Thanks!
ОтветитьI've been trying to figure this out for a long time and this is the best explanation I've found! Thank you!
ОтветитьWhat is the name of the extension for live reload?
ОтветитьThis guy sounds like Seth Rogen - also great video!
ОтветитьVery good Kyle, thanks
ОтветитьThere appears to be a mixture of Inheritance Patterns going on within this single tutorial. As a result, this brings confusion between composition (what the grizzly can do) and inheritance (the grizzly himself). Towards the end, things begin to get a little confusing (you can even hear it in his voice), because there is no clear cut way in organizing it all. Sense Object.create was needed halfway through this tutorial, it would make sense to start and end this tutorial with object delegation and composition, without the need of a constructor function. By going down this road, new JavaScript users will see the different styles to JavaScript programming.
ОтветитьGreat Tutorial! Could you increase the font a little for the next videos? I would appreciate it. ;)
Ответитьyou sound like mordecai from regular show
ОтветитьThis is amazing!!!!!
ОтветитьSimple and to the point. Thanks!
ОтветитьGood video, I'll tweet it. Thx.
ОтветитьBeautiful explanation. Thank you.
ОтветитьImpossible to read on smartphone
ОтветитьYou made me understand class, prototype, instancing in less than 10 minutes, thank you!
ОтветитьGreat explanation thanks for making this video!
ОтветитьThank you so much, in a few minutos I got how the JavaScript Prototype works.
ОтветитьVery clear for me as a Javascript newbie!
ОтветитьAwesome tutorial, simple but not incomplete.
ОтветитьThat was helpful
ОтветитьThank you for the video. I liked the pace. The code we write for applications with JS at work is very procedural: lots of global scope functions, variables. I am looking for ways to manage scope and complexity of the code so I'm learning about features of JS.
ОтветитьThis helped me understand how to implement OOP in my own JavaScript interpreter.
ОтветитьOf all the videos I was skimming through to finally wrap my mind around this subject, this one was my "aha!" moment. Thank you for the brilliant explanation!
Ответитьthank you for this video
ОтветитьThanks , it was short & simple and easy to understand
ОтветитьYup, I remembered why i hate JS.
Ответить