Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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*/
Source by css-tricks.com #
 
PREVIOUS NEXT
Tagged: #Check #If #Function #Exists
ADD COMMENT
Topic
Name
3+6 =