Open this example in the interactive library
Source code
const bands = [
[50, 0.2],
[20, 0.1],
[5, 0.05],
[0, 0],
],
qty = 23;
console.log(bands.find(([threshold]) => qty >= threshold)[1]);
Sample output
0.1

Open this example in the interactive library
const bands = [
[50, 0.2],
[20, 0.1],
[5, 0.05],
[0, 0],
],
qty = 23;
console.log(bands.find(([threshold]) => qty >= threshold)[1]);
0.1