Can someone tell me what's wrong or whats missing?

Tell us what’s happening:
Describe your issue in detail here.

just wondering if someone can point out to me what is wrong with this code?

Thanks so much.

  **Your code so far**

// Setup
var myArr = [ 2, 3, 4, 5, 6];

// Only change code below this line
for (var i = 0; i < myArr.length; i++) {
total += myArr[i];
  **Your browser information:**

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.2 Safari/605.1.15

Challenge: Iterate Through an Array with a For Loop

Link to the challenge:

I would read the error messages that are showing in the console window below the editor, they are telling you exactly what is wrong.

1 Like

You haven’t declared variable total outside of loop.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.