async / await

What do think this JS code prints?


const arr = [3, 1, 2];

const wait = (ms) => new Promise(resolve => {
  setTimeout(resolve, ms);
});

arr.forEach(async item => {
  await wait(item * 100);
  console.log(item);
})

How about this?


const arr = [3, 1, 2];

const wait = (ms) => new Promise(resolve => {
  setTimeout(resolve, ms);
});

const mapped = arr.map(async item => {
  await wait(item * 100);
  return item * 2;
})

console.log(mapped);