Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

switch statement in javascript

switch ("oboe") {
  case "trumpet":
    console.log("I play the trumpet");
    break;
  case "flute":
    console.log("I play the flute");
    break;
  case "oboe":
    console.log("I play the oboe");
    break;
  default:
    console.log("I don't play an instrument. Sorry");
    break;
}
Source by www.freecodecamp.org #
 
PREVIOUS NEXT
Tagged: #switch #statement #javascript
ADD COMMENT
Topic
Name
2+9 =