const a = [27,43,96,74,12,36,12,98,39,24,58,23,45]; const print = (msg, arr) => console.log(msg + ": " + arr.join()); const range = (number, left, right) => number > left && number < right; const test = (arr) => { let res = []; print("Исходный", arr); for (let value of arr) if (range(value, 34, 46)) res.push(value); print("Результат", res); }; test(a);