question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Filter: Rewrite double negative

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
erictleungcommented, Sep 13, 2016

@dogweather I would amenable to this change.

@FreeCodeCamp/issue-moderators second opinions?

2reactions
dhcodescommented, Sep 13, 2016

“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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found