🐛

Spot the Bug

Find the bug in each code snippet. Test your code review skills.

Bug 1 of 12
Score: 0
JavaScript

Where's the bug?

function sum(arr) {
  let total = 0;
  for (let i = 0; i <= arr.length; i++) {
    total += arr[i];
  }
  return total;
}