javascript Switch statement

switchTest("test4");

function switchTest(varName)
{
    switch (varName)
    {
        case "test1": case "test2": case "test3": 
            alert('You entered test 1, 2 or 3');
            break;
        default: 
            alert('You entered something else');
            break;
    }
}
Example of a javascript switch statement, showing multiple cases.

Updated: Tuesday 28th June 2011, 09:56am

There are 0 comments

Leave a comment of your own

Comments are currently closed.