http://rubyquiz.strd6.com 's problem #234, but in javascript