📅  最后修改于: 2022-03-11 15:02:23.495000             🧑  作者: Mango
var arr = [ 0, 1, '', undefined, false, 2, undefined, null, , 3, NaN ];
var filtered = arr.filter(Boolean);
console.log(filtered);
/*
Output: [ 1, 2, 3 ]
*/