How To Check If Object Is Array In JavaScript


In this tutorial, you’ll learn how to check if an Object is an array in JavaScript. For checking if an array, JavaScript provides a built in method called isArray.

let arr = [];
    
if(Array.isArray(arr)){
    console.log('It is an array!!')
} else {
    console.log('Not an array!!')
}