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);
}
const res = {a:"aaa", b:function(){console.log("b")}};
console.log(typeof res.b == "function");
/*true, notice it is b and not b()*/