Answers for "Using Array.isArray() method and Array.length"

0

Using Array.isArray() method and Array.length

// create empty array in javascript
let empty_array = []

// check empty is Array and then check array length
if(Array.isArray(empty_array) && empty_array.length){

  // if empty_array is a array and empty_array has a length
  console.log("Array is not empty")
 // iterate an array

} else {
  // either empty_array is empty
   console.log("Empty Array")
}
// result => Empty Array
Posted by: Guest on May-06-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language