what does this function output function f1() { result.innerHTML = ""; for (var i = 0; i < 5; i++) { setTimeout(() => { counter(i); }, i * 500); } }
Anónimo
My answer was 0-5. This is a trick question about JavaScript which he seems to scoff that I didn't remember setTimeout would do that but then I explain to him what's happening and he doesn't seem to understand it. Turns out if you google JavaScript interview questions its one of the first to come up.