</pre><pre name="code" class="javascript">function something(){
this.doo=function(){ myDo();};
this.doThis=function(){this.tryDoThis();};
this.tryDoThis=function(){console.log('try do this');};
function myDo(){console.log('my do private');}
}
xxx = new something(); //new instance
xxx.doo();
// output: "my do private"
xxx.doThis();
// output: "try do this"
xxx.doo.apply(xxx);
//output: "my do private"
xxx.doThis.apply(xxx)
// output: "try do this"
xxx.doThis.apply({tryDoThis:function(){console.log('piiiiiis')}})
// output: "piiiiiis"
// because "this" was explicitly set, and with a new "tryDoThis" function
xxx.doo.apply({tryDoThis:function(){console.log('piiiiiis')}, myDo:function(){console.log('HAHAHA')}})
// output: "my do private"
// because doo uses myDo, that was defined only in original function. replace "this" with new "myDo" function, make no effect
// consequence: Don't expose your private function on "this"