how to check if an array is null code example
Example 1: javascript check if array is empty
if (array && !array.length) {
// array is defined but has no element
}
Example 2: javascript not empty array not string
if (Array.isArray(array) && array.length) {
// array exists and is not empty
}
Example 3: isempty for arrays
Object arr[] = new Object[10];
boolean empty = true;
for (int i=0; i<arr.length; i++) {
if (arr[i] != null) {
empty = false;
break;
}
}