Implement a function that mimics Promise.all behavior. It should take an array of promises and return a single promise that resolves when all input promises resolve, or rejects if any promise rejects.
Examples
Input:[[{},{}]]
Output:[1,2]
Input:[[{},{}]]
Output:["a","b"]
Hints
Return a new Promise that wraps all the input promises.
Track the number of resolved promises and collect their results in order.
Use Promise.resolve to handle non-Promise values passed in the array.
Promise.all
Implement Promise.all() which resolves to an array of results or rejects if any input rejects.