Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch in if/else problem #36

Open
nrh00 opened this issue Mar 6, 2019 · 0 comments
Open

Switch in if/else problem #36

nrh00 opened this issue Mar 6, 2019 · 0 comments

Comments

@nrh00
Copy link

nrh00 commented Mar 6, 2019

Found this funny using one of your examples...

Duplicated the switch statement, one in the if the other in the else. The IF switch renders fine the ELSE renders wrong.

screenshot 2019-03-06 at 14 24 33

const code = `
function switchSampleFromMDN() {
const foo = 0;
const bar = 0;

    if (bar > 10) {
        switch (foo) {
        case -1:
            console.log('negative 1');
            break;
        case 0:
            console.log(0);
        case 1:
            console.log(1);
            return 1;
        default:
            console.log('default');
        }
    }
    else {
        switch (foo) {
        case -1:
            console.log('negative 1');
            break;
        case 0:
            console.log(0);
        case 1:
            console.log(1);
            return 1;
        default:
            console.log('default');
        }
    }
}

`;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant