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.

Wrong filter description

See original GitHub issue

Describe the Issue

This page incorrectly says that filter keeps elements when the callback returns the Boolean value true. This is incorrect, any element that results in a truthy return value is retained.

Affected Page

https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array

Expected behavior

The line:

filter calls a function on each element of an array and returns a new array containing only the elements for which that function returns true.

Should be replaced with the line:

filter calls a function on each element of an array and returns a new array containing only the elements for which that function returns a truthy value - that is, a value which returns true if passed to the Boolean() constructor.

Screenshots

No response

System

All

Additional context

The file to edit: https://github.com/freeCodeCamp/freeCodeCamp/blob/main/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/functional-programming/use-the-filter-method-to-extract-data-from-an-array.md

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:22 (22 by maintainers)

github_iconTop GitHub Comments

1reaction
naomi-lgbtcommented, Nov 16, 2022

Yep that should be fine.

I’ll go ahead and open this up to contribution, then.

1reaction
naomi-lgbtcommented, Nov 16, 2022

I think we may be splitting hairs on this.

filter calls a function on each element of an array and returns a new array containing only the elements for which that function returns a truthy value - that is, a value which returns true when passed to the Boolean() constructor.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can the Incorrect Air Filter Shorten Engine Life?
The wrong air filter will not protect your engine. Its frame will not match up to the mounting points on your engine, leaving...
Read more >
Filter by Value Transform Function - Wrong Match Description
Using Grafana Enterprise, Transform function “Filter data by values”, a condition has the wrong description associated with it.
Read more >
IV85984: MULTIPLE REPORTS FILTERS ARE SHOWING ...
Error description. In the report/query setup, the setting of the Filter Operator is 'Equals' for Number Type fields, when the report/query is run, ......
Read more >
FILTER function - Microsoft Support
The FILTER function filters an array based on a Boolean (True/False) array. ... Notes: An array can be thought of as a row...
Read more >
What is content filtering and how does it work? - TechTarget
Filtering software can screen content for anything that is objectionable or criminal, including online porn, hate sites, illegal content and social media.
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