Why does my While loop come out out with both "wow" and false?



here is my code

for ( var i = 0; i<26; i+=4){
    console.log("im craaazyyy" + i++)
    var i = true;
why does it log both wow and else?
it logs this

im craaazyyy0
im craaazyyy5
im craaazyyy10
im craaazyyy15
im craaazyyy20
im craaazyyy25


This is the last executed command, so the value of i is still in the buffer and handed back in the closing response. It can be ignored.


I thought I needed to include that to avoid an infinite loop?


Yes, leave the code where it is. It is needed. Just ignore the output.


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