Skip to content

Instantly share code, notes, and snippets.

@sagardere
Created May 23, 2018 13:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sagardere/0006c223b901fa29292e289fba5478f7 to your computer and use it in GitHub Desktop.
Save sagardere/0006c223b901fa29292e289fba5478f7 to your computer and use it in GitHub Desktop.
// In switch statements if you are not add break statements
// after the end of case statements then all cases are executed by defaults
var number = 3;
switch(number){
case 1:
console.log("The number is one");
break;
case 2:
console.log("The number is two");
break;
case 3:
console.log("The number is three");
break;
default :
console.log("The number is : " + number);
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment