0

Why doesn't it work without multiplying by i ???

Please see the code below https://code.sololearn.com/WpTC8w3pY7mn/?ref=app Can you please explain me why this code doesn't work same way without multiplying by i (in line 11)? Thank you!

15th Apr 2020, 12:30 AM
PR PRGR
PR PRGR - avatar
4 Respuestas
+ 1
In this case all 15 timers have the same timeout value and will make output at the same time.
15th Apr 2020, 6:14 AM
Igor Kostrikin
Igor Kostrikin - avatar
+ 1
JS (at least in web browsers) is single threaded: so "all at the same time" is not exactly true... output will occurs without delay between them, because the timers are all done when the first is done if all have the same value ;)
16th Apr 2020, 2:55 AM
visph
visph - avatar
0
Igor Kostrikin Спасибо!
15th Apr 2020, 12:19 PM
PR PRGR
PR PRGR - avatar
0
visph Thank you!
16th Apr 2020, 10:11 AM
PR PRGR
PR PRGR - avatar