if (typeof array !== 'undefined' && array.length === 0) { // the array is defined and has no elements }
if (array && !array.length) { // array is defined but has no element }
if (Array.isArray(array) && array.length) { // array exists and is not empty }
if (array === undefined || array.length == 0) { // array empty or does not exist }
var colors=[]; if(!colors.length){ // I am empty }else{ // I am not empty }
if(array.length > 0)
array.length
if (typeof image_array !== 'undefined' && image_array.length > 0) { // the array is defined and has at least one element }
Array.isArray(emptyArray) && emptyArray.length
array.length = []