Remove element from array, using slice

前端 未结 7 1422
野性不改
野性不改 2021-01-04 02:26

I am trying to remove a element from my array using slice, but i can\'t get it to work, look at this piece of code.

    console.log(this.activeEffects); // P         


        
7条回答
  •  执笔经年
    2021-01-04 02:56

    .slice does not mutate the array, you could use .splice() to remove the item at index i in the array:

    this.activeEffects.splice(i, 1)
    

提交回复
热议问题