我有这个数组:
["onelolone", "twololtwo", "three"]
如何仅使用'lol'
值和结果删除元素:
["three"]
使用Array.prototype.filter
,并检查其中是否不包含"lol"
:
const result = ["onelolone","twololtwo","three"].filter(ele => !ele.includes("lol"))
console.log(result)// ["three"]
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句