Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js switch case

var color = "red";

switch (color) {
    case "blue":
        console.log("color is blue");
        break;
    case "white":
        console.log("color is white");
        break;
    case "black":
        console.log("color is black");
        break;
    case "red":
        console.log("color is red");
        break;

    default:
        console.log("color doesn't match ")
}

//Output: color is red;
 
PREVIOUS NEXT
Tagged: #js #switch #case
ADD COMMENT
Topic
Name
7+8 =