In the following code
let urls = [
'https://api.github.com/users/iliakan',
];
//let requests = urls.map((url) => axios.get(url).then(() => { console.log('Prout')}));
let requests = urls.map((url) => axios.get(url));
console.log('Start');
axios.get(urls[0])
.then((responses) => {
console.log('Got Response');
return Promise.all(requests);
}).then((resp) => {
console.log('Finished Mapping');
});
The console print out the expected
Start
Got response
Finished Mapping
But if you switch with the commented out definition then I get on the console
Start
Prout
Got response
Finished Mapping
...as if the interpreted reordered the logging of 'Got Response' and the execution of promises in requests.
What is happening here ?