Ad
  • Default User Avatar

    It works for the test array because the elements are ordered highest to lowest already.

    Your function won't work if numbers[i] is lower than high1, but higher than high2.

    console.log()ing the numbers array and high1&2 as they are assigned might help clarify this.