title: Find element in array using recursion - javascript
body: <p>I'm trying to select Nth element from array using this function:</p>
  
  <pre><code>function nthArr(arr, index){
      if (index === 0)
          return arr[index];
      else nthArr(arr.slice(1), --index);
  }
  
  nthArr([1,2,3,4,5,6],3)
  </code></pre>
  
  <p>I would await that it returns <code>4</code>, but instead I get 'undefined'.<br/>
  How should I return correct value?</p>