Twelfth problem in js