Java Reference
In-Depth Information
beachParty that is assigned to the party() function before it is called for the first
time and redefined:
function party(){
console.log("Wow this is amazing!");
party = function(){
console.log("Been there, got the T-Shirt");
}
}
var beachParty = party; // note that the party function is
not
invoked
beachParty(); // the party() function has now been
redefined, even
though it hasn't been called explicitly
<< "Wow this is amazing!"
party();
<< "Been there, got the T-Shirt"
beachParty(); // but this function hasn't been redefined
<< "Wow this is amazing!"
beachParty(); // no matter how many times this is called
it will
remain the same
<< "Wow this is amazing!"
Warning: Properties Will Be Lost
If any properties have previously been set on the function, these will be lost
when the function redefines itself. In the previous example, we can set a
test property and see that it no longer exists after the function has been
invoked and redefined:
 
Search WWH ::




Custom Search