en.javascript.info icon indicating copy to clipboard operation
en.javascript.info copied to clipboard

Array methods [Tasks] Filter range "in place" typo

Open GaneshS288 opened this issue 2 years ago • 0 comments

https://javascript.info/array-methods#tasks (The page in question)

[Filter range "in place"]

Write a function filterRangeInPlace(arr, a, b) that gets an array arr and removes from it all values except those that are between a and b. The test is: a ≤ arr[i] ≤ b.

the 'between' in task description implies excluding numbers 1 and 4 so only 2 and 3 should be valid.

let arr = [5, 3, 8, 1];

filterRangeInPlace(arr, 1, 4); // removed the numbers except from 1 to 4

alert( arr ); // [3, 1]

Yet here we have 1 along with 3. The answer is also same as previous task filterRange. Please fix the wording or use an && operator in the solution.

GaneshS288 avatar Nov 07 '23 06:11 GaneshS288