I am trying to remove objects from an array of objects using a user specified indexes. When a user specify a range between m and n, that's mean that all array having indexes less than m or higher then n, I want them to be deleted from the array.
I tried the following when (m=0 and n=7):
for (const array in this.data) {
if (parseInt(array) <= 0 || parseInt(array) >7) {
this.data.splice(parseInt(array))
}
}
console.log(this.data)
And it's working properly, but once I change m into 1, all the array is emptied.
Here is a stackblitz.
const x = data.slice(m, n)then assignthis.data = x.