Is there a way to handle undefined functions being called in JavaScript?

Posted by Emory on Stack Overflow See other posts from Stack Overflow or by Emory
Published on 2010-03-26T23:36:51Z Indexed on 2010/03/26 23:43 UTC
Read the original article Hit count: 324

If I have a function like the following:

function catchUndefinedFunctionCall( name, arguments )
{
    alert( name + ' is not defined' );
}

and I do something silly like

foo( 'bar' );

when foo isn't defined, is there some way I can have my catch function called, with name being 'foo' and arguments being an array containing 'bar'?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about javascript-events