As an example of what I want, if you called a function that is not defined you would get a message like this in the console: nonExistentFunc is not defined
Is it possible to make Javascript call a function rather than display this message? Possibly with Function.prototype?
Your options are:
Set up a global exception handler and wrap all your event handlers in an exception handlers and catch any exception that is thrown by trying to execute a non-existent function and detect that particular exception in your exception handler and then do call your own function to handle that particular exception.
Test specific function calls before calling them to see if the function itself is defined before calling it. You obviously can’t do this for every function in your code (well you could, but it wouldn’t be very practical), but if you had just a few places that you wanted to test for functions being properly defined, then you can write code to test that before calling them like:
Code example: