Knowledge Walls
John Peter
Pune, Maharashtra, India
How to use switch case statement in javascript with Example
3059 Views
Switch case Syntax 
switch (case value){
    case 1:
       break;
    case 2:
       break;
    case 3:
       break;
    default:
}
Example
var caseValue = 2;
switch (caseValue){
    case 1:
       document.write("One");
       break;
    case 2:
       document.write("Two");
       break;
    case 3:
       document.write("Three");
       break;
    default:
       document.write("Not 1,2 or 3");
}
Demo & Output 
Best Lessons of "Good Javascript Examples"
Top lessons which are viewed more times.
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details