Javascript - Program the Web
This course covers the basics of programming in Javascript. Work your way through the videos and we'll teach you everything you need to know to make your website more responsive!

Switch Statements

Lesson 18
Author : Mike Dane
Last Updated : October, 2017


Code

Copyvar myGrade = "A";
switch(myGrade){
     case "A":
          document.write("You Pass");
          break;
     case "F":
          document.write("You fail");
          break;
     default:
          document.write("Invalid grade");
}