0

Question (probably simple one)

I am trying to understand why this code returns the value of “333” instead of “012”: for (var i=0; i<3; i++) { setTimeout(function() {document.write(i) }, 100);}

9th Jun 2019, 1:42 AM
Davis
2 odpowiedzi
+ 1
Its becoz of asynchronous programming that is inbuilt by javascript
19th Aug 2020, 4:06 AM
BeastyDSK
BeastyDSK - avatar
+ 1
U can search in youtube to find becoz it is difficult to explain with words 😊😊😊
19th Aug 2020, 4:12 AM
BeastyDSK
BeastyDSK - avatar