javascript - for Loop with if-else statement -


I want to ask some logic questions here

Let's say I have a loop in javascript to delete the entire item: -

  var i = 0; For (i = 0; i  

I do not want to remove the item when i = current = eg 2 or 3

How do I add another one to this loop at present?

Please help, anybody?

Changing it to reverse order and only removing items that are not equal to the current item.

  Var current = 2; Var i = 0; For (i = items all -1; i> = 0; i--) {if (i! = Current) {removeItem (i); }}  

I should have told the reason for the reverse loop. As Hans commented, loop is used in reverse because the rest of the items can be re-named because of 'deleted eatam'.


Comments