Since functions are first class objects, it should be possible to assign to the members of them.
Am I right thinking that arguments.callee
does this?
Are there any other ways to set these fields?
How is it possible to set field
in first case?
function something1() {
arguments.callee.field = 12;
}
alert(something1.field); // will show undefined
something1();
alert(something1.filed); // will show 12
something2 = function() {
arguments.callee.field = 12;
};
alert(something2.field); // will show undefined
something2();
alert(something2.field); // will show 12
UPDATE 1
I mean how to access members from within function when it runs.