exercise using if/else in JavaScript