Java-Script
Friday, September 18, 2009 8:35:44 PM
I learned recently that javascript parameters and methods don't need to exist to be set.
I was rather suprised by this.
This means that something like ...
function myDisplayFunction(item){ alert(item.toString + " has been passed);}
can be called by something like this:
function init(){
var currentObject;
currentObject.display = myDisplayFunction;
currentObject.display("test");
}
which would associate currentObject with the property "display",
that didn't exist prior to the line of code,
assign myDisplayFunction to it,
and can be called by the original object
as if the functionality existed prior.



