0
In what order will the numbers 1-4 be logged to the console when the code below is executed? Why?
(function() { console.log(1); setTimeout(function(){console.log(2)}, 1000); setTimeout(function(){console.log(3)}, 0); console.log(4); })();
3 Answers
0
1
4
3
2
Because the delay value can be thought of as a minimum delay. Actual delay may vary as the program simply makes its best effort.
https://stackoverflow.com/questions/33955650/what-is-settimeout-doing-when-set-to-0-milliseconds/33955673
0
Hii
- 1
what order will the numbers 1-4 be logged to the console when the belo
7.
function() {
console.log(1);
setTimeout(function()(console.log(2)), 1000); SetTimeout(function()(console.log(3)), 0);
10:
O 1432 1234 2314 O 1423