'Is Browser Api works in Event Loop?

I know event loop is single threaded ,but there is a problem.I'm trying to understand work of async functions.When ı make three request,the second then shouldn't work until first is done right? Yeah until here there is no problem.Also it must be valid for second and three ,but they are done at the same time.

  const start = Date.now();
  async function fetchData() {
    let result = await fetch("https://reqres.in/api/products/3");
    result = await result.json();
    console.log(Date.now() - start, "third with await");
  }
  fetch("https://reqres.in/api/products/3")
    .then((response) => response)
    .then((other) => other.json())
    .then((converted) =>
      console.log(Date.now() - start, "first with then")
    );

  fetch("https://reqres.in/api/products/3")
    .then((response) => response)
    .then((other) => other.json())
    .then((converted) =>
      console.log(Date.now() - start, "second with then")
    );
  fetchData();

The result is;
41 'first with then'
329 'second with then'
329 'third with await'



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source