Last Updated : 03 Sep, 2024
Lodash _.isArray() method checks if the given value can be classified as an Array Value or not.
Syntax:_.isArray(value);Parameters:
Example 1: In this example, we are checking whether the given value is an array or not and print the result in the console by the use of the _.isArray() method.
JavaScript
// Defining Lodash variable
const _ = require('lodash');
let val = [1, 2, 3]
// Checking for an Array
console.log("The Value is Array : "
+ _.isArray(val));
Output:
The Value is Array : true
Example 2: In this example, we are checking whether the given value is an array or not and print the result in the console by the use of the _.isArray() method.
JavaScript
// Defining Lodash variable
const _ = require('lodash');
let val = "GeeksforGeeks"
// Checking for an Array
console.log("The Value is Array : "
+ _.isArray(val));
Output:
The Value is Array : false
Example 3: In this example, we are checking whether the given value is an array or not and print the result in the console by the use of the _.isArray() method.
JavaScript
// Defining Lodash variable
const _ = require('lodash');
let val = { 1: 1 }
// Checking for an Array
console.log("The Value is Array : "
+ _.isArray(val));
Output:
The Value is Array : false
Note: This will not work in normal JavaScript because it requires the lodash library 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