Remove element from array, using slice

前端 未结 7 1424
野性不改
野性不改 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 03:08

    This is what I was able to come up with :

    var newArray = oldArray.slice(indexOfElementToRemove+1).concat(oldArray.slice(0,indexOfElementToRemove));
    
    0 讨论(0)
提交回复
热议问题