var colors=[]; if(!colors.length){ // I am empty }else{ // I am not empty }
if (array && !array.length) { // array is defined but has no element }