JS - 是否可以检查变量是否是对象?

2 javascript web

我正在尝试检查变量是否是这样的对象:

if(obj && typeof obj === Object) {
    console.log('obj is an object and does not return null value');
}
Run Code Online (Sandbox Code Playgroud)

我错过了什么?

Aru*_*hny 5

typeof返回类型的字符串表示形式,但是如果要检查null则

if(typeof obj === 'object' && obj !== null) {
    console.log('obj is an object and does not return null value');
}
Run Code Online (Sandbox Code Playgroud)