I realize a function can be copied to a new variable very easily by writing:
var wu = function() {
// do stuff
)
var tang = wu;
var bee = tang;
// etc
and in this way can go by a theoretically infinite number of names. I also realize that in the above example, I could then say var wu = undefined
and the reference would be removed, but I’m wondering if a function can rename itself as part of its own context? Meaning, can I write:
function wuTang() {
// do stuff
// rename self
}
wuTang(); // runs successfully
wuTang(); // returns undefined
I’m not worried about the process of creating a new name, I’m simply wondering if this is possible. I do not want to call a second function to rename the original function, I want the function to rename itself so it can only be invoked by a given name one time.