📜  js 从数组中删除错误值 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:36.086000             🧑  作者: Mango

代码示例1
const a =[3,,null, false, undefined, 1];

// Remove falsey
a.filter(Boolean);
 
// Remove specific (undefined)
a.filter(e => e !== undefined);