TGViewer
Programming Quiz Channel Programming Quiz Channel @programming_quizz · 796 subscribers
Post #261 456
Find the error in the code.
The answer should be: 15
Difficulty: Average😐

function sumArray(arr) {
let sum = 0;
arr.forEach(function(num) {
sum =+ num;
});
return sum;
}

let numbers = [1, 2, 3, 4, 5];
console.log(sumArray(numbers));
More from @programming_quizz
  1. Oct 14, 2026Post #572
  2. Oct 12, 2026Post #571
  3. Oct 10, 2026Post #570
  4. Oct 8, 2026Post #569
  5. Oct 6, 2026Post #568
  6. Oct 4, 2026Post #567
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →