Um herauszufinden, ob eine bestimmte Funktion existiert (in PHP z.B. mit function_exists('function_name')) benutzt man in JavaScript den typeof-Operater. Beispielcode wie folgt:
if(typeof myNiceCustomFunction == 'function') { // exists myNiceCustomFunction(); // let's call it, too! }