Problem 10 in js