📜  javascript 检查对象是否为对象 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:24.933000             🧑  作者: Mango

代码示例4
//checks if is object, null val returns false
function isObject(val) {
    if (val === null) { return false;}
    return ( (typeof val === 'function') || (typeof val === 'object') );
}
var person = {"name":"Boby Snark"};
isObject(person);//true