JSFiddle - React, Tailwind, and code Playground

by Roman Fedytskyi

JavaScript

function promReq(n) {
	return new Promise(resolve => {
		setTimeout(() => {resolve(`number ----->  ${n} == ${makeid()}`)}, Math.floor(Math.random() * 50000));
	});
}

async function asyncCall(i) {
  var result = await promReq(i);
  console.log(result);
}

for (let i = 1; i < 5000; i++) {
	asyncCall(i);
}

function makeid() {
  var text = "";
  var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";

  for (var i = 0; i < 50; i++)
    text += possible.charAt(Math.floor(Math.random() * possible.length));

  return text;
}