Medium
Debug JavaScript Array Error
Identify and fix a logic error in a provided JavaScript loop.
📝 Prompt İçeriği
Identify the bug in the following JavaScript code and provide the corrected version. The code is intended to sum all numbers in an array but returns NaN: let arr = [1, 2, 3]; let sum = 0; for(let i=1; i<=arr.length; i++) { sum += arr[i]; }