* javascript 1.8 solution for problem 2