Iterate Through an Array with a For Loop - Multiple Initializations
See original GitHub issueChallenge Iterate Through an Array with a For Loop has an issue.
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36
.
Please describe how to reproduce this issue, and include links to screenshots if possible.
My code:
// Example
var ourArr = [ 9, 10, 11, 12];
var ourTotal = 0;
for (var i = 0; i < ourArr.length; i++) {
ourTotal += ourArr[i];
}
// Setup
var myArr = [ 2, 3, 4, 5, 6];
// Only change code below this line
for (**var total = 0**, i = 0; i < myArr.length; i++) {
total += myArr[i];
}
Multiple initialization not accepted as correct solution.
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Using multiple variables in a for loop in Python - Stack Overflow
I would argue that the simplest way of iterating over a list in Python is to omit indices altogether: for i in array:...
Read more >Multiple Initializations and Increments in for loop Easy Way Lec
In the discussion on for loop, only one variable has been initialized and incremented in the initialization and increment part of the loop....
Read more >Multiple Initializations and Increments in for loop | Lesson 38.2
In this class, we will try to understand Multiple Initializations and Increments in for loop. We have already discussed the concept of for ......
Read more >Iterating an Array using a For Loop - Appficial - YouTube
It is common to iterate through the elements of an array. A for loop is typically used to access every element of the...
Read more >For Statement (The GNU Awk User's Guide)
The for statement makes it more convenient to count iterations of a loop. The general form of the for statement looks like this:...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Okay, just confirmed. The changes are on staging via https://github.com/FreeCodeCamp/FreeCodeCamp/commit/f8425780ec0f9866354e5ce23e745a2d5e9f6ebc
And the blame on Line 5268 and others is still yours.
Basically, this should get fixed when we merge to master during future release?
Closing as this has been resolved in the beta. Happy coding!