Problem 22 in js