Combining User Input with switch Statement: a JavaScript Example