coding
Find and fix the bugs (JavaScript)
Prompt
Find and fix every bug in this function, then show the corrected code and list each bug in one line:
```js
function sumEven(nums) {
let total;
for (let i = 0; i <= nums.length; i++) {
if (nums[i] % 2 == 0) total += nums[i];
}
return total;
}
```Answers will appear here after the first test run.