Checks if value is a plain object, that is, an object created by the Object constructor or one with a [[Prototype]] of null.
value
Object
[[Prototype]]
null
The value to check.
Returns true if value is a plain object, else false.
true
false
5.6.0
function Foo() { this.a = 1}isPlainObject(new Foo)// => falseisPlainObject([1, 2, 3])// => falseisPlainObject({ 'x': 0, 'y': 0 })// => trueisPlainObject(Object.create(null))// => true Copy
function Foo() { this.a = 1}isPlainObject(new Foo)// => falseisPlainObject([1, 2, 3])// => falseisPlainObject({ 'x': 0, 'y': 0 })// => trueisPlainObject(Object.create(null))// => true
Checks if
value
is a plain object, that is, an object created by theObject
constructor or one with a[[Prototype]]
ofnull
.