Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript check if function exists

if (typeof sourceObj.someMethod === "function") { 
    // you are safe using the method
  	sourceObj.someMethod();
}
Source by css-tricks.com #
 
PREVIOUS NEXT
Tagged: #javascript #check #function #exists
ADD COMMENT
Topic
Name
8+1 =