我想从使用切片的数组中删除一个元素,但是我无法让它工作,请看这段代码。从数组中删除元素,使用切片
console.log(this.activeEffects); // Prints my array
console.log(this.activeEffects.slice(0,1)); // Remove from index 0, and remove one.
console.log(this.activeEffects); // Prints array again, this time my element should be gone
结果是这样的。
那么,什么是充分利用这一点,在第一个数组是完整的,因为它应该是。然后,它打印什么是数组的切片。最后第三个应该是空的?要么?
有可能使的jsfiddle这个? – 2012-08-07 14:50:31
你确定这是一个数组吗? – 2012-08-07 14:51:52