1
2
var fruits = ['orange', 'citron', 'banane', null, 'noix', '', undefined, 'fraise'];
var fruits_filtre = fruits.filter( function(val){return val !== ''} );
const arr = ["Hello", "", "king", "", "queen", "", "early"];
const result = arr.filter(e => e);
console.log(result); // ["Hello", "king", "queen", "early"]