Tasks involve work such as rendering, parsing HTML and CSS, running the JavaScript code you write. The main thread is where most tasks are run in the browser. When tasks stretch beyond a certain point, they're classified as long tasks. Using setTimeout here is problematic, because the ergonomics of it make it difficult to implement.
Table of contents
What is a task? #What is the main thread? #Task management strategies #Gaps in current APIs #Conclusion #Sort: