Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript switch statement

switch (new Date().getDay()) {      // input is current day
case 6:                         // if (day == 6)
	text = "Saturday";          
	break;
case 0:                         // if (day == 0)
	text = "Sunday";
	break;
default:                        // else...
	text = "Whatever";
}
Source by htmlcheatsheet.com #
 
PREVIOUS NEXT
Tagged: #javascript #switch #statement
ADD COMMENT
Topic
Name
4+2 =