function createUser(email) {
  console.log('creating user')
  return {
    email: email,
    id: Math.round(Math.random() * 100)
  }
}

function doSomethingWithUser(id) {
  console.log(id)
}

function createUsers(emails) {
  return Promise.all(emails.map(async function createAndUpdateUser(email) {
    const newUser = await createUser(email)
    await doSomethingWithUser(newUser.id)
    console.log('about to return ', newUser.id)
    return newUser.id
  }))
}

const ids = createUsers(['[email protected]', '[email protected]', '[email protected]'])
ids.then((values) => {
  console.log(values)
})