[Vuejs]-Deleting object from array in vue props

3👍

Lets take this array:

  [1, 2, 3]

If you remove the first element you end up at:

 [2, 3]

Now you remove the second element:

[2]

And the third:

 [2]

As you can see, you actually want to splice out the first element until the array is empty:

 while(nav.length)
   nav.splice(0, 1);

or just:

  nav.splice(0, nav.length);

Leave a comment