数组过滤null,undefined,空字符串

const arr = ['a','b',null,undefined,'c','','d']
arr.filter(Boolean) //['a','b','c','d']

  

posted @ 2022-02-08 11:56  是你吗我笑了  阅读(114)  评论(0)    收藏  举报