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();
}
16 Luglio 2013 | 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();
}