My Opera is closing 3rd of March

Quotidian Melange

One meandering doughnut after another

Java-Script


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.

My current wish list - potentially updated as I go alongIt has been said that "In the beginning, there was the note."

Write a comment

New comments have been disabled for this post.

February 2014
M T W T F S S
January 2014March 2014
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28