logo CodeStepByStep logo

parameterMystery8

Language/Type: JavaScript parameters return

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

function main() {
    let x = "happy";
    let y = "pumpkin";
    let z = "orange";
    let pumpkin = "sleepy";
    let orange = "vampire";
    apple(y, x, z);
    x = apple(x, z, y);
    apple(pumpkin, z, "y");
    z = "green";
    apple("x", "pumpkin", z);
    apple(x, z, orange);
}

function apple(z, y, x) {
    console.log(y + " and " + z + " were " + x);
    return x + y + z;
}
line 1
line 2
line 3
line 4
line 5

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.