Thursday, October 9, 2025
HomeLanguagesJavascriptLodash _.isArray() Method

Lodash _.isArray() Method

The Lodash _.isArray() method checks if the given value can be classified as an Array Value or not.

Syntax:

_.isArray( value )

Parameters: This method accepts a single parameter as mentioned above and described below:

  • value: This parameter holds the value that needs to be Checked for an Array.

Return Value: This method returns a Boolean value.

Example 1: When this method returns true.

Javascript




// Defining Lodash variable
const _ = require('lodash'); 
     
var val = [1, 2, 3]
  
// Checking for an Array
console.log("The Value is Array : "
    +_.isArray(val));


Output:

The Value is Array : true

Example 2: When this method returns false for strings.

Javascript




// Defining Lodash variable
const _ = require('lodash'); 
     
var val = "neveropen"
  
// Checking for an Array
console.log("The Value is Array : "
    +_.isArray(val));


Output:

The Value is Array : false

Example 3:

Javascript




// Defining Lodash variable
const _ = require('lodash'); 
     
var 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.

RELATED ARTICLES

Most Popular

Dominic
32348 POSTS0 COMMENTS
Milvus
87 POSTS0 COMMENTS
Nango Kala
6715 POSTS0 COMMENTS
Nicole Veronica
11878 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11941 POSTS0 COMMENTS
Shaida Kate Naidoo
6837 POSTS0 COMMENTS
Ted Musemwa
7095 POSTS0 COMMENTS
Thapelo Manthata
6791 POSTS0 COMMENTS
Umr Jansen
6791 POSTS0 COMMENTS