Problem 1 complete in Javascript for loop