This question is a real head-scratcher! I'm going to go with B) 0 1 2 3 because it just makes the most sense to me. But who knows, maybe the exam writers are trying to trick us with this one.
I'm confused. Shouldn't the answer be C) 0 1 1 2? The first logCounter() call logs 0, the setTimeout call logs 1, and the setInterval call increments Counter and logs the new value, but the last log statement should be 2, not 3.
No, that's not correct. The first logCounter() call logs 0, the setTimeout call logs 0 again, and the setInterval call increments Counter and logs the new value.
I'm going with D) 0 1 2 2. The setInterval call increments Counter and logs the new value, but the last log statement should be 2 since the interval is 1 second and the setTimeout is 1.1 seconds.
I think the answer is B) 0 1 2 3. The code sets the Counter variable to 0, and then the first logCounter() call logs 0. The setTimeout call logs 0 after 1.1 seconds, and the setInterval call increments Counter and logs the new value every 1 second, so the output should be 0 1 2 3.
Edwin
1 months agoMila
1 months agoDante
1 months agoGalen
1 months agoBrande
2 days agoLeonida
6 days agoPatria
16 days agoKami
2 months agoTruman
2 days agoThora
17 days agoDewitt
27 days agoGolda
1 months agoMichel
2 months agoPura
2 months agoMargret
29 days agoAlex
1 months agoTabetha
1 months agoTorie
1 months agoMatthew
2 months agoMichel
2 months ago