changed the JavaScript if/else if statement to a switch statement