Problem 14 in js