JavaScript Loops, Arrays and Strings