Web app hanging after loop

Code below will hang the app when the for loop attempts to equate i < loop (the second for loop). Changing length to a number or not using it in the loop will prevent the hang.

I’ve tested in both firefox and chrome with the same result.

Codepen app (link) using the same code does not appear to have any issues.

Any help/insight would be appreciated.

function permAlone(str) {
  var length = str.length;
  //return length;
  var perm = 1;
  for (var i = 2; i <= length; i++) {
    perm *= i;
  }
  //return length*perm;
  var loop = length*perm;
  loop = loop.toString();
  loop = Number(loop);
  //return loop;
  var permArr = [];
  for (i = 0; i < loop; i++) {
    permArr[i] = i;
  }
  return permArr;
  return str;
}

permAlone('aab');

I don’t understand what are you trying to accomplish here

Simply trying to initialize an array. The web app crashes, but the code seems fine as I tested it on code pen.

This is more of a software question than coding question perhaps, but if there is an issue with the code I’d like to hear that as well

It might just be that some of the test cases for the challenge are creating too large a number for loop. You may be triggering FCC’s built in infinite loop protection.

That seems to be the case, thanks for the quick response.
I’ve triggered that before, usually it come with a warning message rather than crashing, but good to know for the future.