problem 9 in js