title: Replace a letter with its alphabet position
body: <p>This looked fairly straightforward to me when I started, but for some reason I'm getting an empty array everytime I try to run the result on codewars. I'm hoping you can help me identify what the problem is.</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>function alphabetPosition(text) {
    text.split(' ').join('');
    var chari = "";
    var arr = [];
    var alphabet = "abcdefghijklmnopqrstuvwxyz".split('');
    for(var i = 0; i &lt; text.len; i++){
      chari = text.charAt(i).toLowerCase();
      if(alphabet.indexOf(chari) &gt; -1){
        arr.push(alphabet.indexOf(chari));
      }
    }
    return arr;
  }
  console.log(alphabetPosition("Hello World"));</code></pre>
  </div>
  </div>
  </p>
  
  <p>My idea is to get the text from the parameter then strip out the spaces. I made a variable for my empty array and make an alphabet string that I can later search through. In the for loop, i make each character lowercase, and if the character is found in the alphabet string, its position gets pushed into the array (arr). I appreciate your time.</p>