How to remove element from array in forEach loop?

前端 未结 7 532
耶瑟儿~
耶瑟儿~ 2020-11-28 03:37

I am trying to remove an element in an array in a forEach loop, but am having trouble with the standard solutions I\'ve seen.

This is what I\'m current

7条回答
  •  心在旅途
    2020-11-28 04:04

    You could also use indexOf instead to do this

    var i = review.indexOf('\u2022 \u2022 \u2022');
    if (i !== -1) review.splice(i,1);
    

提交回复
热议问题