Quantcast
Channel: JavaScript filter method returning filtered array and empty array - Stack Overflow
Browsing index pages (3 articles)

JavaScript filter method returning filtered array and empty array

I am trying to log the current reading status but instead of getting just the log I am also getting an empty array when calling displayInformation(). How can I get the result I want without an...

View Article


Answer by Rajaprabhu Aravindasamy for JavaScript filter method returning...

How can I get the result I want without an additional empty array?You have to use .forEach() or a normal for loop to do what you want to do. .filter() use case is entirely different from yours.why is...

View Article


Answer by Mike Cluck for JavaScript filter method returning filtered array...

That's because you're printing out statusFilter which is the result of filtering using statusRead. Since statusRead never returns true, the result will be empty. The way that filter works is it will...

View Article
Browsing index pages (3 articles)


Latest Images