exercise using switch statement in JavaScript