title: Remove smallest number in JS Array
body: <p>I have a number array [2, 1, 3, 4, 5, 1] and want to remove the smallest number in the list. But somehow my IF statement gets skipped. </p>
  
  <p>I checked and by itself "numbers[i + 1]" and "numbers[i]" do work, but "numbers[i + 1] &lt; numbers[i]" doesn't...</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function removeSmallest(numbers) {
    var smallestNumberKEY = 0;
    for (i = 0; i &lt;= numbers.lenths; i++) {
      if (numbers[i + 1] &lt; numbers[i]) {
        smallestNumberKEY = i + 1;
      }
    }
    numbers.splice(smallestNumberKEY, 1);
    return numbers;
  }
  
  document.write(removeSmallest([2, 1, 3, 4, 5, 1]));</code></pre>
  </div>
  </div>
  </p>