title: JavaScript Recursion
body: <p>Would someone be kind enough to explain this program (taken from a book tutorial) step by step in plain language to help me understand recursion?</p>
  
  <pre><code>var reverseArray = function(x,indx,str) {
  return indx == 0 ? str : reverseArray(x, --indx, (str+= " " + x[indx]));;
  }
  
  var arr = new Array('apple', 'orange', 'peach', 'lime');
  var str = reverseArray(arr,arr.length,"");
  alert(str);
  
  var arr2 = ['car','boat','sun','computer'];
  str = reverseArray(arr2,arr2.length."");
  alert(str);
  </code></pre>