{ Dev Farm }

Web & Windows Development

How to check if a Javascript Function Exists or Is Defined

| 0 commenti

0.00 avg. rating (0% score) - 0 votes

To check if a function exists before you try and call it (and get a nasty javasscript error), use typeof to check.

Heres a sample:

if(typeof helloWorld == 'function') {
    // function exists, so we can now call it

Lascia un commento

I campi obbligatori sono contrassegnati con *.

:bye:  :good:  :negative:  :scratch:  :wacko:  :yahoo:  B-)