.pull` to vanilla JS?
This question already has an answer here:
The problem is that filter returns a new array. Why not just use a for loop and splice:
if (Array.isArray(object)) {
for (var i = object.length - 1; i >= 0; i--) {
if (object[i] === undefined) {
object.splice(i, 1);
}
}
}
链接地址: http://www.djcxy.com/p/37748.html
上一篇: 从数组中删除空或未定义的元素
下一篇: .pull`给香草JS?