I'm trying to access an inner function from outside a function in Javascript, but it only prints "undefined" instead of printing the function's source code. How can I modify the prototype of the function changeBlah from outside the scope of exampleFunction?
var blah = "";
function exampleFunction(theParameter){
this.blah = theParameter;
this.changeBlah = function(){
this.blah += "gah";
}
}
var stuff2 = new exampleFunction("Heh!");
alert(stuff2.blah);
stuff2.changeBlah();
alert(stuff2.blah);
alert(exampleFunction.changeBlah); //now why doesn't this work? It doesn't print the function's source code, but instead prints undefined.
exampleFunction.changeBlahwithstuff2.changeBlahprints the function's source.