Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the nextgen-gallery-pro domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/mxvysmpn/public_html/wp-includes/functions.php on line 6121
How to check if a Javascript Function Exists or Is Defined | How to check if a Javascript Function Exists or Is Defined – { Dev Farm }

{ Dev Farm }

Web & Windows Development

How to check if a Javascript Function Exists or Is Defined

| 0 commenti

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
    helloWorld();
}

Lascia un commento

I campi obbligatori sono contrassegnati con *.