JSFiddle - React, Tailwind, and code Playground
JavaScript
// передать в новый массив диапозон из старого массива
var oldMas = [0,2,4,6,9,1,3,5,5];
var newMas = [];
var numberA = +prompt("Введите число А", '');
var numberB = +prompt("Введите число B", '');
function filtered(arr, a, b) {
for(var i = 0; i < arr.length; i++) {
if(arr[i] >= a && arr[i] <= b ) {
newMas.push(arr[i]);
}
}
}
filtered(oldMas, numberA, numberB);
alert(newMas);