I am getting a very strange behavior while splicing the object from the array.
I have a js array with objects. I am passing it via props and populating a navigation based on it. Now when I try to delete it inside created hood
it deleted half and keep half.
Here is the code. Very simple
props: {
navItems: {
type: Array,
},
},
In created hook I have
let nav = this.navItems
for(let j in nav){
nav.splice(j,1)
}
console.log(nav) // print half item from the array. Shouldn't remove all?
this.nav = nav
Thank you.