xxxxxxxxxx
if (typeof payment === "function")
{
// Do something
}
xxxxxxxxxx
//check if sayHello() function exists
if (typeof sayHello === "function") {
// This function exists
}
xxxxxxxxxx
if (typeof yourFunctionName == 'function') {
yourFunctionName();
}
xxxxxxxxxx
//check if myProcedure() function exists
if (typeof myProcedure === "function") {
// This function exists
}
xxxxxxxxxx
if (typeof sourceObj.someMethod === "function") {
// you are safe using the method
sourceObj.someMethod();
}