Add JS solution to problem 8