To remove a response from a comment:
for (var subPermutation of permAlone(remainingString))iterates over the return value of a function (called recursively). This is the error line number. Numbers are not repeated, so when you return a number instead of an array, it throws an error.
, , FireFox
TypeError: permAlone (...)
. , , , , , .