-
9,undefined is returned due to variable hoisting and duplicate definition rules in Javascript. The second function foo() is called because it is declared last. The first function bar() is called because functions are hoisted above variables in the same function in Javascript.
-
Here is the code to request several URLs.
/*
Promise.all is fail fast, so make all promises successful.
Use a result object to store the request status.