Answers for "how to check if array is null"

PHP
17

array empty check in php

if (empty($array)) {
     // list is empty.
}
Posted by: Guest on April-15-2020
5

javascript check if array is not empty

if (array === undefined || array.length == 0) {
    // array empty or does not exist
}
Posted by: Guest on November-17-2020
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

Code answers related to "how to check if array is null"

Browse Popular Code Answers by Language