logo CodeStepByStep logo

arrayMystery4

Language/Type: JavaScript arrays array mystery

What are the contents of the array arr after the following code executes?

let arr = [];
for (let i = 1; i <= 8; i++) {
    arr.push(10 * i);   //   0   1   2   3   4   5   6   7
}                       // [10, 20, 30, 40, 50, 60, 70, 80]
for (let i = 0; i < arr.length; i++) {
  arr.splice(i, 1);
}

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.