Problems with loops and timers

  1. all know that if you set a timer in a loop, use var and do not change the internal function to execute the function immediately, it will print out 5

    in the loop.
       

Mar.05,2021

the third is because the first argument you pass into setInterval is actually the result of the execution of a function, not a function


because there is no callback

let a = function(i){
    console.log(i,"i")
}(i)

a;//undefined
Menu