Wednesday, October 31, 2012

Javascript: Class.method vs. Class.prototype.method vs. Class.apply.method

Class.method - a custom method added in this way only exists for that particular instance of an object. if you want a custom method or property to be added to all instances of the object, that's where prototype object comes in.

Class.prototype.method - prototype object can help you to quickly add a custom method to an object that is reflected on all instances of it.

Class.apply.method - allows to apply a method of one object to another.

No comments:

Post a Comment