title: Check if value in array exists and if it's smaller than the next in this array
body: <p>I need to check if a value (from an input field) exists in a given array and if that value is also smaller than the next value in that same array. </p>
  
  <p>The input value is for changing an amount of items in a shopping cart. Based on that quantity a corresponding price will be used to calculate the totals.</p>
  
  <p>I've got an array with the following contents;</p>
  
  <pre><code>[
    { id: 1, price: "20.0000", qty: "2.0000" },
    { id: 2, price: "15.0000", qty: "4.0000" },
    { id: 3, price: "10.0000", qty: "8.0000" }
  ]
  </code></pre>
  
  <p>Let's say the input value is <code>2</code>, then the price I want to calculate is would be <code>20.0000</code> and if the input value is <code>3</code>, the price would also be <code>15.0000</code>, and so on. So it's not only looking for a matching number, but also checking if the number is lower than the following in the above array.</p>
  
  <p>Is there a good and clean way to get something like this done? I've searched for examples, but couldn't find one that's the same as mine.</p>