1if (typeof array !== 'undefined' && array.length === 0) {
2 // the array is defined and has no elements
3}
4
1if(typeof array != 'undefined' && array.length > 0){
2 // array has elements
3}
1if (!Array.isArray(array) || !array.length) {
2 // array does not exist, is not an array, or is empty
3 // ⇒ do not attempt to process array
4}
5
1if (array === undefined || array.length == 0) {
2 // array empty or does not exist
3}
4
1if (typeof image_array !== 'undefined' && image_array.length > 0) {
2 // the array is defined and has at least one element
3}