• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

switch

JavaScript1.2+, JScript 3.0+ NES3+, Nav4+, IE4+ Syntax

switch(expression){
  case label1:
							code;
    break;
  case label2:
							code;
    break;
  case labelN:
							code;
    break;
  default:
    code;
}

Description

The switch statement allows you to process the expression passed by matching it with a label—from label1 to labelN. If there is a match, the code following that label is executed. If the expression passed does not match a label, the default section is executed. Note that you can have as many labels as you deem necessary in your script.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint