javascript check if function exists
//check if sayHello() function exists
if (typeof sayHello === "function") {
// This function exists
}
check if function exists javascript
if (typeof payment === "function")
{
// Do something
}
js check if function exists
if (typeof yourFunctionName == 'function') {
yourFunctionName();
}
Check If Function Exists
const obj = {first: function() {console.log("ssss"); return "returns"} };
console.log(_.result(obj, "first"));
/*note that _.result() returns a value, so if your function doesn't return anything _.result() will return undefined*/