1if (typeof array !== 'undefined' && array.length === 0) {
2 // the array is defined and has no elements
3}
4
1if (typeof image_array !== 'undefined' && image_array.length > 0) {
2 // the array is defined and has at least one element
3}
1var colors=[];
2if(!colors.length){
3 // I am empty
4}else{
5 // I am not empty
6}