[Wylug-help] javascript function defined???

j.lander at leeds.ac.uk j.lander at leeds.ac.uk
Wed Oct 8 08:49:51 UTC 2008


> is it possible to check if a function (defined in another .js file) has 
> been defined?
>
> I know you can use typeof() == 'undefined' for variables, objects etc., 
> but it doesn't seem to be working with functions.

Caveat: I'm not a Javascript programmer, but borrowing ideas from 
elsewhere, you could try calling your function within a try...catch block.

   try {
     garys_missing_function(....);
   } catch (e) {
     # Damn.. its not there
   }

- Jason



More information about the Wylug-help mailing list