Junior — Senior
Determining the result of a function with Promise and sparse arrays
livecode
Task condition
What result will be returned when calling the function
const ajax = () => new Promise((resolve, reject) => {
const result = [];
for (let id = 0; id < 10; id++) {
result[id * id] = {
id,
hash: Math.ceil(Math.random() * 10)
};
}
resolve(result);
});