Async problem in for cycle

async function getTitle(url) {
    let response = await fetch(url);
    let html = await response.text();
    return html.match(/<title>([\s\S]+)<\/title>/i)[1];
  }
  for(let i=0;i<2;iPP){
    let urls = `https://img.codeshelper.com/upload/img/2021/03/25/ltgsbnm3h0313274.png](/img/bVbdCHI)

throw a brick to attract jade.

async function getTitle(url) {
  let response = await fetch(url);
  let html = await response.text();
  return html.match(/<title>([\s\S]+)<\/title>/i)[1];
}
(async function () {
  for (let i = 0; i < 2; iPP) {
    let urls = `https://tc39.github.io/ecma262/`

    let result = await getTitle(urls).then(function (title) {
      console.log('22222', title, i)
      return title
    })
    console.log(result,Date.now())
  }
})()

then you call the second request after the first one gets the data and processes it. (need to adjust your processing logic), similar to

i=0;
function abc(x){
    let result = await getTitle(urls).then(function(title){
    console.log('22222',title,i)
    iPP;
    if(i<x) abc(x);
    return title
}
abc(3);
Menu