if (typeof yourFunctionName == 'function') {
yourFunctionName();
}
if (typeof sourceObj.someMethod === "function") {
// you are safe using the method
sourceObj.someMethod();
}
//check if myProcedure() function exists
if (typeof myProcedure === "function") {
// This 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*/