Last Updated : 04 Sep, 2024
Lodash _.isPlainObject() method checks if the value is a plain object which means an object created by the Object constructor or one with a [[Prototype]] of null.
Syntax:_.isPlainObject(value);Parameters:
This method accepts a single parameter as mentioned above and described below:
Example 1: In this example, we are checking whether the given value is an object or not by the use of the lodash _.isPlainObject() method.
javascript
// Requiring the lodash library
const _ = require("lodash");
// Original array
let object = _.isPlainObject(Object.create(null));
// Using the _.isPlainObject() method
let plain_data = (object);
// Printing the output
console.log(plain_data);
Output:
true
Example 2: In this example, we are checking whether the given value is an object or not by the use of the lodash _.isPlainObject() method.
javascript
// Requiring the lodash library
const _ = require("lodash");
// Original array
let object = _.isPlainObject([1, 2, 3]);
// Using the _.isPlainObject() method
let plain_data = (object);
// Printing the output
console.log(plain_data);
Output:
false
Example 3: In this example, we are checking whether the given value is an object or not by the use of the lodash _.isPlainObject() method.
javascript
// Requiring the lodash library
const _ = require("lodash");
// Original array
let object = _.isPlainObject({ 'x': 0, 'y': 0 });
// Using the _.isPlainObject() method
let plain_data = (object);
// Printing the output
console.log(plain_data);
Output:
true
Note: This code will not work in normal JavaScript because it requires the library lodash to be installed.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4