logo CodeStepByStep logo

parameterMystery10

Language/Type: JavaScript parameters return

The following console program uses parameters and produces four lines of output. What are they?

function main() {
    let x = 5;
    let y = 1;
    let z = 9;
    let w = y + 2;
    surprise(x, y);
    x = surprise(z, w);
    w++;
    z = surprise(w, x);
    surprise(y, z);
}

function surprise(y, x) {
    x++;
    console.log(x + " " + y);
    y--;
    return x;
}
line 1
line 2
line 3
line 4

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.