Simple question about console.log in used with the For loop
Hello. I have a question about console.log used in a For loop. Does console.log print the value of the first statement at the start of each loop? Consider the following: https://code.sololearn.com/W9m6a3s2CvtX/#js After the first For (i;i<l;i++) happens, i should increase by 1. However, console.log returns the value as 0. So I can only think that console.log is returning the value at the start of the iteration. How can I make it so it returns the increased value? EDIT: I achived this by using document.write(text + i + "<br>"); EDIT AGAIN: My code just got more complicated. I used IF for displaying the final value, but outside the code block. However, if I used IF inside the block, it console.log will only return the first loop. I just wanted to know whether there is a way to get the last value by with some code inside the loop.