Sorry, but that's impossible. If
undefined did something or had a function, it would no longer be undefined. So even if you try to overwrite
undefined with something, it would still be undefined. Even if it were possible to change
undefined, that would be a very, very,
very bad idea.
When
undefined throws an error, it's because you have a bug. If it stopped throwing errors, you'd still have the bug, but now you don't know where the bug happens.
However, the biggest problem by far is that
undefined doesn't always throws errors.
You can for example do:
Code:
if (event) {
// do something
}
If
event is
undefined, then the code inside the
if branch won't execute. That's because
undefined is not truthy (it doesn't evaluate to
true).
By adding a function to
undefined, it would become an object (one that contains a function) and become truthy. This would break not only a large number of plugins, but might also completely break the RMMV core scripts as well.
TL;DR
Just don't do it.