add js solution to problem 9