isPlainObject
The isPlainObject function checks if a value is a plain object, created by a literal or by Object.
Syntax
typescript
isPlainObject(value): booleanParameters
| Name | Type | Description |
|---|---|---|
value | any | Value to be checked. |
Return
| Type | Description |
|---|---|
boolean | Returns true if the value is a plain object, otherwise false. |
Examples
typescript
isPlainObject({}); // true
isPlainObject(Object.create(null)); // true
isPlainObject([]); // false
isPlainObject(new Date()); // falseNotes
- Plain objects are created by
{}ornew Object(). - Returns
falsefor arrays, functions, class instances, and native objects.
