I got a quiz question in my Full Stack Web Development online course that states the following:
let sum = 0;
for (let i = 0; i < 5; i++) {
for (let j = 0; j < 2; j++) {
sum = sum + i + j;
continue;
}
}
console.log(sum);
Now, the correct answer to the question is 25 according to the answer of the quiz, but I have no idea how it gets to 25? The closest I get when writing it out on paper to try and visualize it, is either 15 / 16.
Could someone please write a visualization that would make it clearer for me on how this nested loop gets to 25?
Thanks in advance.
Add a console after second for, you should see the visualization