JSFiddle - React, Tailwind, and code Playground

JavaScript

console.log("--- Start with nothing ---");

if(x && x.constructor==Array && x.length){
    console.log("is array and filed");
}else{
   console.log('no var or empty array');
   // do stuff
}

console.log('----- Created Empty array ----');
var x=[]; 
console.log(x);
console.log(x.length);
console.log(x.length>0);
console.log(x.length <1);

if(!x.length){
console.log('empty');
} else {
    console.log('full');
}


console.log('------ prefilled array ---');
x =["1","2","3"];


if(x && x.constructor==Array && x.length){
    console.log("is array and filed");
}else{
    x= [];
    console.log('empty array');
}

console.log(x);
console.log(x.length);
console.log(x.length>0);
console.log(x.length <1);

if(x.length <1){
console.log('empty');
} else {
    console.log('full');
}

if(!x.length){
console.log('empty');
} else {
    console.log('full');
}