Open diveDylan opened 4 years ago
setTimeout(() => console.log('task 100ms') },100) setTimeout(() => console.log('task 10ms') },10) // output // 1、task 100ms // 2、task 10ms
timer算是同步任务,setimeout(fn,delay)中的fn为回调的宏任务,整个事件机制的执行更像是这样
timer
setimeout(fn,delay)
fn
---get timer 100ms ---get timer 10ms --- mic Task [timer10Fn] --- mic Task[timer100Fn]
timer
算是同步任务,setimeout(fn,delay)
中的fn
为回调的宏任务,整个事件机制的执行更像是这样