You need to know, this example is wrong

it's not work

1,2,3,4 will be output at the same time.

const waitFor = (ms) => new Promise((r) => setTimeout(r, ms));

const start = async () => {

await array.forEach(async function (element) {

await waitFor(1000);

console.log(element);

});

console.log('Done');

};

start();

Develop with pleasure!

Develop with pleasure!