Problem 7 in js