const review = ["a", "b", "c", "b", "a"];
review.forEach((item, index, arr) => {
if (item === "a") {
arr.splice(index, 1);
}
});
var pre = document.getElementById('out');
function log(result) {
pre.appendChild(document.createTextNode(result + '
'));
}
var review = ['a', 'a', 'b', 'c', 'b', 'a', 'a'],
index = review.indexOf('a');
while (index !== -1) {
review.splice(index, 1);
index = review.indexOf('a');
}
log(review);
var pre = document.getElementById('out');
function log(result) {
pre.appendChild(document.createTextNode(result + '
'));
}
var review = ['a', 'b', 'c', 'b', 'a'];
review.forEach(function(item, index, object) {
if (item === 'a') {
object.splice(index, 1);
}
});
log(review);