MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Array › filter
Array.prototype.filter() - JavaScript | MDN
December 13, 2025 - The filter() method of Array instances creates a shallow copy of a portion of a given array, filtered down to just the elements from the given array that pass the test implemented by the provided function.
W3Schools
w3schools.com › jsref › jsref_filter.asp
JavaScript Array filter() Method
The filter() method creates a new array filled with elements that pass a test provided by a function.
Filter array in objects array
Hello everyone, I have the following construct: const allProducts = [ { img:" xyz", desc: "xyz", categories:["Men", "Sportshoes"]; } ] I want to get all products, where categories includes Men. I tried: allProducts.filter((item)=>item.categories.includes("Men")) also: allProducts.filter((i... More on forum.freecodecamp.org
Is there a way to filter this array twice without creating an extra variable?
Yes. Use &&. const filtered = myArray.filter((value, index, array) => { return value % 2 === 0 && array.indexOf(value) === index; }); More on reddit.com
What's the best/fastest way to filter a long array containing 20k objects?
Build an index or trie. Or try a js search engine. More on reddit.com
[AskJS] Lazy alternative for Array.filter() and co?
I imagine people who are against lodash are just against lazy alternatives in general. Dev time is more valuable to me than squeezing out a couple cycles more of performance. If you’re in the same mindset as well, just use lodash. Also, lodash is actually really performant. The people who work on it knew what they were doing. Odds are that those extra cycles are going to be non-trivial to squeeze out and difficult to read anyway. Seriously just use lodash. Edit: punctuation and disclaimer More on reddit.com
Videos
04:18
JavaScript Array Filter Method - Basic Example & Real Project Example ...
JavaScript filter() method in 6 minutes!
11:15
How to Use filter() in JavaScript | Filter Arrays Like a Pro - YouTube
02:58
JS Array Methods Explained #6 - FILTER Method - YouTube
06:57
Mastering the Javascript Array.filter Method: A Comprehensive Guide ...
00:49
Filter an Array of Objects with JavaScript - YouTube
GitHub
github.com › zloirock › core-js
GitHub - zloirock/core-js: Standard Library
import 'core-js/actual'; Promise.try(() => 42).then(it => console.log(it)); // => 42 Array.from(new Set([1, 2, 3]).union(new Set([3, 4, 5]))); // => [1, 2, 3, 4, 5] [1, 2].flatMap(it => [it, it]); // => [1, 1, 2, 2] Iterator.concat([1, 2], function * (i) { while (true) yield i++; }(3)) .drop(1).take(5) .filter(it => it % 2) .map(it => it ** 2) .toArray(); // => [9, 25] structuredClone(new Set([1, 2, 3])); // => new Set([1, 2, 3])
Starred by 25.5K users
Forked by 1.7K users
Languages JavaScript
Adripofjavascript
adripofjavascript.com › blog › drips › filtering-arrays-with-array-filter.html
Filtering Arrays with Array#filter - A Drip of JavaScript
The filter method accepts a callback function. In that callback function we examine each element of the array indidually, and return true if we want the element to pass the filter.
Vultr Docs
docs.vultr.com › javascript › standard-library › Array › filter
JavaScript Array filter() - Filter Array Elements | Vultr Docs
November 28, 2024 - This method provides an efficient way to sift through arrays and select only those elements which meet the criteria you define, all without altering the original array. In this article, you will learn how to utilize the filter() function to selectively process and manipulate array data.
Programiz
programiz.com › javascript › library › array › filter
Javascript Array filter()
Returns a new array with only the elements that passed the test. ... const prices = [1800, 2000, null, 3000, 5000, "Thousand", 500, 8000] function checkPrice(element) { return element > 2000 && !Number.isNaN(element); } let filteredPrices = prices.filter(checkPrice); console.log(filteredPrices); // [ 3000, 5000, 8000 ] // using arrow function
Server Side Up
serversideup.net › blog › filter-sort-and-search-arrays-with-javascript
Filter, Sort, and Search Arrays with JavaScript | Server Side Up
October 4, 2022 - The first parameter is the value of the array as we iterate over it. The arrow is a callback function that returns true or false if the filter is matched. So if number % 2 == 0 then it's even and we return true. In most scenarios, you'd probably want to update a table, or make some UI changes. In straight JavaScript, you'd take the response from this method and use it to display the data instead of the full numbers array.
Educative
educative.io › answers › what-is-the-javascript-array-filter
What is the JavaScript Array filter()?
It takes as an argument an array and a function and applies the function to each element in the array. Once done, it returns an array containing all the elements that pass the condition set by the argument function. Here is the function signature for the filter() function in Javascript:
TutorialsPoint
tutorialspoint.com › filter-array-with-filter-and-includes-in-javascript
Filter array with filter() and includes() in JavaScript
January 28, 2025 - filter(): It is used to create a new array that includes only the elements that satisfy the condition provided by the callback function. includes(): Using includes(), the callback function checks if the element from array1 is present in array2. In JavaScript, a callback function is a function ...
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-filter-an-array-of-objects-based-on-multiple-properties-in-javascript
How to Filter an Array of Objects Based on Multiple Properties in JavaScript ? - GeeksforGeeks
August 5, 2025 - The filter() method is a built-in array method in JavaScript that creates a new array with elements that pass the provided function's test.