JS Cómo filtrar la matriz imutable de rango
// @ts-check
let arr = [5, 3, 8, 1];
function filterRange(arr, a, b) {
return arr.filter((item) => a <= item && item <= b);
}
let filtered = filterRange(arr, 1, 4);
console.log(filtered); // => [ 3, 1 ]
console.log(arr); // => [ 5, 3, 8, 1 ]
Condemned Corncrake