title: Javascript - Use Variable as Array Index
body: <p>Trying to use a variable as an array index. Variable <code>addThirteen</code> simply takes <code>i</code> and adds 13 to it. I need to use that result as the array index. Please see my code:</p>
  
  <pre><code>for (var i = 0; i &lt; alphabetArr.length; i ++) {
    var addThirteen = (parseInt(i) + parseInt(13));
    var newCipher = new cipher(alphabetArr[i].letter, alphabetArr[addThirteen].letter);
  }
  </code></pre>
  
  <p>This results in: </p>
  
  <blockquote>
    <p>TypeError: undefined is not an object (evaluating
    'alphabetArr[addThirteen].letter')</p>
  </blockquote>
  
  <p>Appreciate any help.</p>