logo CodeStepByStep logo

parameterMystery14

Language/Type: JavaScript parameters return

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

function main() {
    let a = 137;
    let b = 42;
    console.log("a = " + a);
    foo(b);
    console.log("a = " + a);
    console.log("b = " + b);
    a = bar(b, a + b);  
    console.log("a = " + a);
    a = bar(a, b);  
    console.log("a = " + a);
}

function foo(a) {
    console.log("a = " + a);
    a = 160;
}

function bar(c, b) {
    let d = b - c;
    console.log("d = " + d);
    return d % 10;
}
line 1
line 2
line 3
line 4
line 5
line 6
line 7
line 8

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.