85.promiseOrder

Write a function named promiseOrder that receives an Array of Promises as a parameter.

The function should return a Promise that will resolve to an Array of numbers - let's name it order - representing the order in which each of the input Promises was resolved.

Example 1

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

promiseOrder([
    wait(100),
    wait(1000),
    wait(50)
]).then((order) => {
  console.log(order); // [1, 2, 0]
});

/**
 * The first Promise that resolves is the third one, so
 * that means it will get index 0. Then, the first promise
 * resolves, so it gets index 1. Finally, the second promise
 * resolves, so it gets index 2.
 */