title: bubble sort in javascript - recursive version not working
body: <p>I tried to build a Bubble Sort algorithm to sort an array. It works in sorting the array, but for its recursive implementation, it never stops... I understand I should put some break clause to stop the execution of the for loop, but I'm not sure where. </p>
  
  <p>Could please someone provide some useful guidance on these types of problems with recursive functions? </p>
  
  <p>Thank you</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>input = [1, 7, 5, 6, 8, 9, 9, 100, 24, 35, 10]
  
  function bubbleSort(input) {
    for (let i = 0; i &lt; input.length; i++) {
      if (input[i] &gt; input[i + 1]) {
        let newvar = input[i];
        input[i] = input[i + 1];
        input[i + 1] = newvar;
        bubbleSort(input);
      }
    }
  };
  console.log(bubbleSort(input));</code></pre>
  </div>
  </div>
  </p>