孤陋寡闻,在一次交流中学习到这个词,然后查查资料学习一下,记录下来

虚值:

javascript中的值为false的值,只有六个虚值
undefined,null,NAN,0,'',false

如何过滤虚值:

let arr = [1,2,3,0,false,null,'ff'];

let list = arr.filter(Boolean);//[ 1, 2, 3, 'ff' ]

Banshee
124 声望4 粉丝

To die is to die, to live is to suffer