MAYDAY1993 / mayday1993.github.io

只记录技术问题
https://mayday1993.github.io/
8 stars 1 forks source link

plain object #28

Open MAYDAY1993 opened 7 years ago

MAYDAY1993 commented 7 years ago

isPlainObject(Object.create({})); //=> true isPlainObject(Object.create(Object.prototype)); //=> true isPlainObject({foo: 'bar'}); //=> true isPlainObject({}); //=> true

isPlainObject(1); //=> false isPlainObject(['foo', 'bar']); //=> false isPlainObject([]); //=> false isPlainObject(new Foo); //=> false isPlainObject(null); //=> false isPlainObject(Object.create(null)); //=> false