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 }
arr = []; // set array=[] //function const empty = arr => arr.length = 0; //example var arr= [1,2,3,4,5]; empty(arr) // arr=[]
if (array === undefined || array.length == 0) { // array empty or does not exist }
var colors = ["red","blue","green"]; colors = []; //empty the array
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