JavaScript function redefinition

Viewed 28761

Is it possible to redefine a JavaScript function from within its own body. For example, could I do the following?

function never_called_again(args) {
  // Do some stuff
  never_called_again = function (new_args) {
    // Do some new stuff
  }
}

Is the above valid and does it have the correct semantics? I don't want to create a new global variable with the old function name, because I'm trying to do this kind of thing not in the global scope, but from various object scopes, and I don't want name clashes when I redefine the function within those local scopes.

6 Answers
Related