Answers for "javascript how to check if an object is empty array or null"

0

Check If An Array Is Empty Or Null Or Undefined In JavaScript?

let myArray = [];

if( myArray.length  > 0  ) {
    console.log(myArray);
    console.log("Array has elements");
}
else {
    console.log("Array has no elements");
}
Posted by: Guest on August-09-2021
0

check javascript object not array and not null

function isObject (item) {
  return (typeof item === "object" && !Array.isArray(item) && item !== null && item!==undefined);
}
Posted by: Guest on July-28-2021

Code answers related to "javascript how to check if an object is empty array or null"

Code answers related to "Javascript"

Browse Popular Code Answers by Language