You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: easy/filter-array.js
+8Lines changed: 8 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,11 @@
1
+
/**
2
+
* Filters an array based on a provided function and returns a new array with elements that pass the test.
3
+
*
4
+
* @param {Array} arr - The array of elements to be filtered.
5
+
* @param {function} fn - The function to test each element. It takes two arguments: the current element and its index. Should return a boolean indicating whether the element should be included in the new array.
6
+
* @returns {Array} - A new array containing only the elements that passed the test.
0 commit comments