JSFiddle - React, Tailwind, and code Playground

JavaScript

// assume keys in rprice object are sorted integers
function x(rprice, qty) {
    var prev = -1;
    var next = -1;
    var i;
    return(rprice[0][0])
    for (i in rprice) {
        var n = parseInt(i[0]);
        if ((prev != -1) && (qty < n))
            return n;
        else 
            prev = n;
    }
}

var rprice = [
    ["1", "39.99"],
    ["5", "24.99"],
    ["10", "19.99"]
]

alert(x(rprice, 3));
alert(x(rprice, 7));