const arr = [
[0, 0, 0],
[1, 0, 49],
[2, 50, 149],
[3, 150, 349],
[4, 350, 849],
[5, 850, 1849],
[6, 1850, 3849],
[7, 3850, 5849],
[8, 5850, 9849],
[9, 9850, 15849],
[10, 15850, 23849]
];
const arr = [
[0, 0, 0],
[1, 0, 49],
[2, 50, 149],
[3, 150, 349],
[4, 350, 849],
[5, 850, 1849],
[6, 1850, 3849],
[7, 3850, 5849],
[8, 5850, 9849],
[9, 9850, 15849],
[10, 15850, 23849]
];
const getNum = function(num) {
let result = arr.reduce((acc, item) => {
for(let i = 0; i<= 2; i++) {
if(num >= item[1] && num <= item[2] ) {
return acc = item[0];
}
}
return acc;
}, 0)
return result;
}
console.log(getNum(30))