Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="[add your bin description]">
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
const urls = ['url1', 'url2', 'url3'];
function fakeFetch(url, params = '-') {
  // этот вывод в консоль покажет порядок вызовов с их входящими параметрами
  console.log(`fakeFetch to: ${url} with params: ${params}`);
  return new Promise(resolve => {
    setTimeout(() => resolve(`${url} is DONE`), 1000);
  })
};
async function asyncAwaitWay(callback) {
    let results;
     // noprotect
    for (const url of urls) {  
        results = await fakeFetch(url, results);
    }
    callback(results);
}
asyncAwaitWay(result => console.log(`result: ${result}`))
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
andr213pro
0viewers