Filter: Rewrite double negative
See original GitHub issueChallenge 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.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:3
- Comments:7 (6 by maintainers)
Top Results From Across the Web
Filter: Rewrite double negative · Issue #10695 - GitHub
The intro sentence uses a double negative: The filter method is used to iterate through an array and filter out elements where a...
Read more >Double Negation in R - Stack Overflow
Change your code to the following: df[df$yy != 2013 | df$mm != 1,] ... You can also accomplish this by using filter from...
Read more >Double Negatives Teaching Resources - TPT
A colorful printable containing 32 flashcards. Students must determine whether each target sentence is correct or incorrect (16 of each).
Read more >Refactor Negate If - Wiki
It's easy to reverse the sense of an if/then/else. This is typically done to eliminate "double-negative" logic: ... Why change it around in...
Read more >What is a Double Negative? - Vappingo
A double negative occurs when a clause contains two negative words that serve to cancel one another out. They are generally acceptable in ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@dogweather I would amenable to this change.
@FreeCodeCamp/issue-moderators second opinions?
“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.