Skip to content

Instantly share code, notes, and snippets.

@digitup
Created November 19, 2012 09:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save digitup/4109913 to your computer and use it in GitHub Desktop.
Save digitup/4109913 to your computer and use it in GitHub Desktop.
JavaScript - Switch statement
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