Closed AlexanderKidd closed 3 months ago
Edit: It seems to be working (and blazing fast for this training model) by turning off the Beta Console for now.
I also have things like Live Code Validation and Autosave/Autorun off so that might help too.
Probably just some very odd synchronicity issues going on with console mostly?
Changing your code to something that works:
function main() {
ITERATIONS = 10
let i = 0
while ( i < ITERATIONS ) {
console.log(i)
i++;
}
console.log("This is printing out immediately");
}
main()
This code behaves exactly how I'd expect:
Tested in JSFiddle, native browser console, other playgrounds (MDN, etc). All have the same result. Having our UI Console
turned on doesn't seem to change anything for me.
If you have more details, and can post a working example of it not working as expected please let me know. Closing for now since it seems to be invalid.
I have a button to run a main() function, and inside the main function is a while loop that goes for a certain number of iterations.
The issue is the part OUTSIDE the while loop (after it) is getting triggered as soon as the first while loop iteration is done.
Really bizarre, I don't believe plain JS is supposed to do that and I've double-checked my encapsulation in brackets.
Pseudocode: