Solved problem 1 for javascript