how to verify function exists in window object using Javascript code example
Example 1: javascript check if function exists
if (typeof sourceObj.someMethod === "function") {
// you are safe using the method
sourceObj.someMethod();
}
Example 2: js check if function exists
if (typeof yourFunctionName == 'function') {
yourFunctionName();
}