Answers for "check if object has method javascript"

1

javascript check object methods

Object.getOwnPropertyNames()
Posted by: Guest on July-18-2020
1

check if object has method javascript

if(typeof myObj.prop2 === 'function') {
    alert("It's a function");
} else if (typeof myObj.prop2 === 'undefined') {
    alert("It's undefined");
} else {
    alert("It's neither undefined nor a function. It's a " + typeof myObj.prop2);
}
Posted by: Guest on June-25-2020

Code answers related to "check if object has method javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language