nodejs check where funciton exists code example
Example 1: check if function exists javascript
if (typeof payment === "function")
{
// Do something
}
Example 2: javascript check if function exists
if (typeof sourceObj.someMethod === "function") {
// you are safe using the method
sourceObj.someMethod();
}