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.
forEach
This is what I\'m current
Use Array.prototype.filter instead of forEach:
Array.prototype.filter
var pre = document.getElementById('out'); function log(result) { pre.appendChild(document.createTextNode(result + '\n')); } var review = ['a', 'b', 'c', 'b', 'a', 'e']; review = review.filter(item => item !== 'a'); log(review);