Example 6-6. Using array.map() with an inline callback

This example has been corrected from the original version by changing forEach to map.


var requests = accounts.map(function (account) {
    return ajax('/balances/' + account);
});