Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

switch case in javascript

var color = prompt("enter color");

switch(color) {
    case "red":
      console.log("stop")
      break;
    case "green":
        console.log("go head")
      break;
      case "yellow":
        console.log("get ready")
      break;
    default:
        console.log("enter valid color")
  }
 
PREVIOUS NEXT
Tagged: #switch #case #javascript
ADD COMMENT
Topic
Name
2+8 =