// 1. this.TestFunc ();
It's good. This will work, and other calls will be deleted.
(Well, this works until you separate RealFunc from its owner and call it yourself, for example var method= myObj.RealFunc; method(); or through an event handler or timeout. In this case, this in RealFunc will not be an instance of MyObject, and you will need to look at the closure or Function.bind to make it work.)
No, TestFunc is not defined as a variable in a local or global scope. This causes the error you get from Firebug.
No, you were right. :-) It will be MyObject.prototype.TestFunc.call(this) , done explicitly.
JavaScript confuses things a bit by placing some of the same methods on standard constructor functions for built-in objects as on their prototypes (for example, String.split exists where really only String.prototype.split should). But this does not happen with your own objects unless you explicitly say something like MyObject.TextFunc= MyObject.prototype.TextFunc .
source share