Slight Problem in Code


#1

Hello! I have a slight problem. In the code below, for while function, 5 appears twice. Anyone knows why?

for(var i = 0; i < 6; i++) {
    console.log(i);
};

var value = 0;

while(value < 6) {
    console.log(value);
    value++;
};

#2

console behavior, it is not really important, but i can understand you ask.

When you would open your web console, you don't see this behavior, plus the console is mostly used for debugging so then it is fine the last variable gets logged, is easier


#3

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