Méthodes d'objet de vérification JavaScript
Object.getOwnPropertyNames()
Clumsy Cobra
Object.getOwnPropertyNames()
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);
}