Can anyone please explain how does setTimeout function work in javascript? I'm attaching a onclick
listener to some HTML element and the onclick
function provides a call back function there. When I click the HTML element, it redirect to another page. My question here will be the following :
setTimeout(function(){...}, 0)
, does that mean it will be putting on a background thread and always being fully executed? Thanks a lot,
Take a look at the MDN page for setTimeout.
It would really help to see some code implementation but generally a callback with a timeout delay of 0 would call the given callback instantly.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.