Created
November 19, 2012 09:58
-
-
Save digitup/4109913 to your computer and use it in GitHub Desktop.
JavaScript - Switch statement
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var jsLang = 'jquery'; | |
switch (jsLang) { | |
case 'jquery': | |
alert('jQuery Wins!'); | |
break; | |
case 'prototype': | |
alert('prototype Wins!'); | |
break; | |
case 'mootools': | |
alert('mootools Wins!'); | |
break; | |
case 'dojo': | |
alert('dojo Wins!'); | |
break; | |
default: | |
alert('Nobody Wins!'); | |
} | |
//outputs "jQuery Wins!" | |
// copied from http://www.jquery4u.com/snippets/jquery-switch-statement/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment