Just 2 days ago my answer got deleted by one of the moderators. I remember that previously the reason for the cleanup was stated at the bottom of the post.
I haven't got any objection, I only want to know why it got deleted.
My answer:
Just 2 days ago my answer got deleted by one of the moderators. I remember that previously the reason for the cleanup was stated at the bottom of the post.
I haven't got any objection, I only want to know why it got deleted.
My answer:
Both .splice()
and .filter()
solutions exist from years before your answer. Here are the first three answers for each approach:
For .splice()
:
And more.
For .filter()
:
And more.
And the ES6 mention is completely irrelevant to the answer - the only ES6 code you have is the arrow function in the .filter()
call. Your hint is completely wrong anyway: most likely you are advising against people using
function(e) { e !== 3 }
which - yes, would not work, but no, it is not because of the arrow function but because the correct code is:
function(e) { return e !== 3 }
let arr = [1, 2, 3, 4];
arr = arr.filter(function(e){ return e !== 3 }); // -> arr became [1, 2, 4]
console.log(arr);
The answer is duplicated and also misleading. There are A LOT of duplicate and misleading answers in that Q&A. There are 4 full pages of visible answers (30 per page + 9 visible answers on page 5 = 129 visible answers). Out of 205 (-129 = 76 deleted answers).
Every few weeks somebody decides to add yet another thing that either has been explained way better a decade ago, or just their own take on the question which does not really answer it. We normal users cannot deal with all of this ourselves. I applaud moderators taking action against answers that are not needed there.