Additional Data Logged to Console


#1

https://www.codecademy.com/en/courses/javascript-beginner-en-ASGIv/2/1?curriculum_id=506324b3a7dffd00020bf661

So I passed this section, and the information I intended to log to the console IS logged in the console, but it also logs the number 4 after all the intended text (as below) and I'm not sure why. Any insight would be appreciated!

For Loop
For Loop
For Loop
For Loop
While Loop
While Loop
While Loop
While Loop
While Loop
4


for(i = 0; i < 4; i++){
    console.log("For Loop")
};
var count = 0;
while(count <5){
    console.log("While Loop");
    count++;
};


#2

its console behavior, you update a variable after the last console log, so this variable is also logged to the console, easy fix:

count++;
console.log("While Loop");

#3

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