Freecodecamp: Filter: Rewrite double negative

Created on 11 Sep 2016  ·  7Comments  ·  Source: freeCodeCamp/freeCodeCamp

Challenge Filter Arrays with filter has an issue.

The intro sentence uses a double negative:

The filter method is used to iterate through an array and filter out elements where a given condition is not true.

I suggest re-writing in the positive because it's easier to read and understand. Also, it's how I happen to think of filter, and maybe others do too. Here I made that change, plus removed "filter" from its own definition, and changed it from passive to active voice:

_The filter method iterates through an array and selects elements where a given condition is true._

first timers only help wanted

Most helpful comment

@dogweather I would amenable to this change.

@FreeCodeCamp/issue-moderators second opinions?

All 7 comments

@dogweather I would amenable to this change.

@FreeCodeCamp/issue-moderators second opinions?

"And keep only the elements where a given condition returns true" or something along those lines, maybe?

"The filter method is used to create a new array by iterating through the array it is called upon and keeping only elements where a given condition returns true."

I think it's important to know that .filter() makes a new array.

Oh yeah... I was merely referring to the double negative part of the whole thing.

I like the addition of creating a new array. How about in active voice:

"filter creates a new array from an existing one by iterating over it and returning only the elements where a given condition returns true."

This is kind of a long sentence, though. Also returning is more correct than keeping, but might be confusing to someone new to this.

cc: @risachi

Fine by me @dogweather. Let's not wordsmith this to death 👍

I am working on this issue. Will send a PR across :)

Was this page helpful?
0 / 5 - 0 ratings