I am trying to rewrite this async loop using map but I can't achieve the desired result
const wait = (ms) => new Promise((r) => setTimeout(r, ms));
const numbers = [1, 2, 3, 4, 5];
const loop = async() => {
  for (const number of numbers) {
    console.log(number);
    await wait(500);
  }
};
loop();But when I try:
const wait = (ms) => new Promise((r) => setTimeout(r, ms));
const numbers = [1, 2, 3, 4, 5];
const loop = async() => {
  numbers.map(async(number) => {
    console.log(number);
    await 500;
  });
};
loop();It gives sync behavior!
Can you tell me where is the mistake please?
