Caesars Cipher - Potential Infinite Loop Error

Tell us what’s happening:
I’m getting a ‘Potential infinite loop error’ on line 9 (the If statement). Last time I tried to override the protection, I had a bad time.

Your code so far

function rot13(str) { // LBH QVQ VG!
  var regular = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
  var reverse = 'NOPQRSTUVWXYZABCDEFGHIJKLM'.split('');
  var regExp = /[A-Z]/ ;
  var newArr = [];

  for (i = 0; str.length; i++){
    if (regExp.test(str[i])){
      var int = regular.indexOf(str[i]);
    } else {
  return newArr;

// Change the inputs below to test
rot13("SERR PBQR PNZC");

Link to the challenge:

it should be (i = 0; i<str.length; i++)