Splicing out of arrays is quite a challenge because when you splice out, you change the numbering.
I think it might be better to generate the list of the rows that need to be spliced and then splice all at the same time.
This doesn't actually solve the problem.
Unless you do the splicing backwards!!!
Clever.
Need to sort the list from the largest to the smallest first.
fruits.reverse(); - Should also work.
This has worked well. Reversing is really a clever trick that makes life much easier.
It probably would remove the need to generate a list of rows that need to be spliced but that's OK for now.
No comments:
Post a Comment