Call stack
anonymous()
Web APIs
click(cb)
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
cb
UI Tasks
cb
Net Tasks
Render
r
S
L
P
Micro Tasks
m1
m2
m3
m4
loop
Event Loop
Call stack
anonymous()
Web APIs
click(cb)
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
cb
UI Tasks
cb
Net Tasks
Render
r
S
L
P
Micro Tasks
m1
m2
m3
m4
loop
Event Loop
Call stack
anonymous()
Web APIs
click(cb)
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
cb
UI Tasks
cb
Net Tasks
Render
r
S
L
P
Micro Tasks
m1
m2
m3
m4
loop
Event Loop
Call stack
anonymous()
Web APIs
click(cb)
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
cb
UI Tasks
cb
Net Tasks
Render
r
S
L
P
Micro Tasks
m1
m2
m3
m4
loop
Event Loop
Call stack
anonymous()
Web APIs
click(cb)
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
cb
UI Tasks
cb
Net Tasks
Render
r
S
L
P
Micro Tasks
m1
m2
m3
m4
loop
Event Loop
Call stack
cb()
getUserInfo()
Web APIs
click(cb)
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
cb
UI Tasks
cb
Net Tasks
Render
r
S
L
P
Micro Tasks
m1
m2
m3
m4
loop
Event Loop
Call stack
cb()
getUserInfo()
fetch()
Web APIs
click(cb)
HTTP
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
cb
UI Tasks
cb
Net Tasks
Render
r
S
L
P
Micro Tasks
m1
m2
m3
m4
loop
Event Loop
Call stack
cb()
getUserInfo()
fetch()
Web APIs
click(cb)
HTTP
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
cb
UI Tasks
cb
Net Tasks
Render
r
S
L
P
Micro Tasks
m1
m2
m3
m4
loop
Event Loop
Call stack
cb()
getUserInfo()
fetch()
Web APIs
click(cb)
HTTP
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
cb
UI Tasks
cb
Net Tasks
Render
r
S
L
P
Micro Tasks
m1
m2
m3
m4
loop
Event Loop
Call stack
cb()
getUserInfo()
fetch()
Web APIs
click(cb)
HTTP
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
cb
UI Tasks
cb
Net Tasks
Render
r
S
L
P
Micro Tasks
m1
m2
m3
m4
loop
Event Loop
Call stack
cb()
getUserInfo()
fetch()
Web APIs
click(cb)
HTTP
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
cb
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m2
m3
m4
loop
Event Loop
Call stack
cb()
getUserInfo()
fetch()
Web APIs
click(cb)
HTTP
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
cb
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m2
m3
m4
loop
Event Loop
Call stack
m()
getUserInfo()
fetch()
Web APIs
click(cb)
HTTP
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
cb
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m2
m3
m4
loop
Event Loop
Call stack
m()
getUserInfo()
fetch()
Web APIs
click(cb)
HTTP
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
cb
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m2
m3
m4
loop
Event Loop
Call stack
m()
json()
fetch()
Web APIs
click(cb)
json()
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
cb
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
json()
fetch()
Web APIs
click(cb)
json()
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
cb
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
json()
fetch()
Web APIs
click(cb)
json()
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
cb
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
json()
fetch()
Web APIs
click(cb)
json()
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
cb
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
json()
fetch()
Web APIs
click(cb)
json()
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
cb
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
json()
fetch()
Web APIs
click(cb)
DOM()
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
cb
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
json()
fetch()
Web APIs
click(cb)
DOM()
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
json()
fetch()
Web APIs
click(cb)
DOM()
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
json()
fetch()
Web APIs
click(cb)
DOM()
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
json()
fetch()
Web APIs
click(cb)
DOM()
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
json()
fetch()
Web APIs
click(cb)
HTTP
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
json()
fetch()
Web APIs
click(cb)
HTTP
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
json()
fetch()
Web APIs
click(cb)
HTTP
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
json()
fetch()
Web APIs
click(cb)
HTTP
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
json()
fetch()
Web APIs
click(cb)
HTTP
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
json()
fetch()
Web APIs
click(cb)
HTTP
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
json()
fetch()
Web APIs
click(cb)
HTTP
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
json()
fetch()
Web APIs
click(cb)
json()
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
json()
fetch()
Web APIs
click(cb)
json()
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
json()
fetch()
Web APIs
click(cb)
json()
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
json()
fetch()
Web APIs
click(cb)
json()
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
json()
fetch()
Web APIs
click(cb)
json()
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
json()
fetch()
Web APIs
click(cb)
HTTP
HTTP
HTTP
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
json()
fetch()
Web APIs
click(cb)
HTTP
HTTP
HTTP
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
map()
anonymous()
Web APIs
click(cb)
HTTP
HTTP
HTTP
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
map()
anonymous()
Web APIs
click(cb)
HTTP
HTTP
HTTP
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
map()
anonymous()
Web APIs
click(cb)
HTTP
HTTP
HTTP
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
map()
anonymous()
Web APIs
click(cb)
HTTP
HTTP
HTTP
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
map()
anonymous()
Web APIs
click(cb)
HTTP
HTTP
HTTP
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
map()
anonymous()
Web APIs
click(cb)
HTTP
HTTP
HTTP
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
map()
anonymous()
Web APIs
click(cb)
HTTP
HTTP
HTTP
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
map()
anonymous()
Web APIs
click(cb)
HTTP
HTTP
HTTP
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
map()
anonymous()
Web APIs
click(cb)
HTTP
HTTP
HTTP
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
map()
anonymous()
Web APIs
click(cb)
HTTP
HTTP
HTTP
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
map()
anonymous()
Web APIs
click(cb)
json()
json()
json()
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
map()
anonymous()
Web APIs
click(cb)
json()
json()
json()
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
map()
anonymous()
Web APIs
click(cb)
json()
json()
json()
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
map()
anonymous()
Web APIs
click(cb)
json()
json()
json()
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
map()
anonymous()
Web APIs
click(cb)
json()
json()
json()
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
map()
anonymous()
Web APIs
click(cb)
json()
json()
json()
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
map()
anonymous()
Web APIs
click(cb)
json()
json()
json()
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
map()
anonymous()
Web APIs
click(cb)
json()
json()
json()
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
map()
anonymous()
Web APIs
click(cb)
json()
json()
json()
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop
Call stack
m()
map()
anonymous()
Web APIs
click(cb)
json()
json()
json()
Code

                btnSlow.onclick = () => getUserInfo(1);

                const getUserInfo = (id) => {
                  fetch('user')
                    .then(res => res.json())
                    .then(user =>
                      content.innerHTML = 'User info'
                    )
                    .then(() => fetch('posts'))
                    .then(res => res.json())
                    .then(posts => {
                      content.innerHTML += `${posts}`
                      return Promise.all(
                        posts.map(post =>
                          fetch('comments')
                        )
                      )
                    })
                    .then(res => Promise.all(
                      res.map(r => r.json())
                    ))
                    .then(comments => {
                      document.posts.forEach(p => {
                        p.innerHTML += comments
                      })
                    })
                    .catch(err => console.error(err))
                }
                
              
DOM Tasks
d
UI Tasks
cb
Net Tasks
cb
Render
r
S
L
P
Micro Tasks
m
m
m3
m4
loop
Event Loop