Friday, January 5, 2018

I'm realizing a little more about how the prototype keyword works in JavaScript.

foo.prototype.somethingNew = whatever;

...creates a new property on foo called somethingNew with whatever as the assignment while this...

 
 

foo.prototype = whatever;

...makes all properties on whatever now properties on foo too. prototype basically says "Bolt this/these on." while a dot off of prototype kinda says: "Bolt this/these on here."

No comments:

Post a Comment