Add Javascript solution to problem 3