Account for people modifying string prototype in for loop