Ask coding questions

← Back to all posts
Switch Statement Inside of Switch Statement JavaScript
qwerty_________ (2)

I was just wondering whether you could do a switch statement inside of another switch statement.

Answered by theangryepicbanana (1305) [earned 5 cycles]
View Answer
Commentshotnewtop
theangryepicbanana (1305)

You should be able to:

switch(1) {
    case 1:
        switch(2) {
            case 2:
                //stuff
                break;
        }
        break;
}