1:.instanceof typeof 运算符
{} instanceof Object // true 这个方法是基于原型链判断,适用于原型链 数组对象。
typeof 100 === ‘number’ // true 这个方式使用于 基本类型 判断函数。
- alert(typeof undefined);
- alert(Object.prototype.toString.apply(undefined));
[object Object]
- alert(typeof null);
- alert(Object.prototype.toString.apply(null));
[object Object]