Plain Object:纯粹的对象(经过 "{}" 或者 "new Object" 建立的)数组
将简单对象转为数组?prototype
好比转类数组的对象arguments能够用Array.prototype.slice.call(arguments);code
能够转数组的对象,必须符合两个条件:对象
1,对象的元素索引使用数字。索引
2,对象必须有length属性。get
JS代码io
var obj = {};
obj[0] = 1;
obj[1] = 2;
obj.length = 2;
alert(Array.prototype.slice.call(obj));function
关于React中Redux里面的 isPlainObject 的判断方法:object
export default function isPlainObject(obj) {方法
if (typeof obj !== 'object' || obj === null) return false let proto = obj while (Object.getPrototypeOf(proto) !== null) { proto = Object.getPrototypeOf(proto) } return Object.getPrototypeOf(obj) === proto
}