New to this whole concept of prototypes in Javascript and might be confused.
Let's say I have a class called Widget, defined as:
var Widget = function (options) {
// constructor code here
}
Widget.prototype.constructor = Widget;
Widget.prototype.myGreatFunction = function(){}
Should I be able to call Widget.myGreatFunction(); or do I need to call Widget.prototype.myGreatFunction()? to run the great function?
Widget.prototype'sconstructorproperty already refers toWidget. You don't needWidget.prototype.constructor = Widget;unless you replace the object thatWidget.prototyperefers to.