logo CodeStepByStep logo

loopMystery3

Language/Type: JavaScript for loops loop mystery
Author: Melissa Hovik (on 2016/09/25)

What is the output of the following JavaScript code?

let total = 24;
for (let number = 1; number <= (total - (total % 2) / 2); number++) {
    total = total - number;
    console.log(total + " " + number);
}
output

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.