how to test whether function or method javascript code example
Example: js check if function exists
if (typeof yourFunctionName == 'function') {
yourFunctionName();
}
if (typeof yourFunctionName == 'function') {
yourFunctionName();
}