promise all in promise all
var arr = [
{subarr: [1,2,3]},
{subarr: [4,5,6]},
{subarr: [7,8,9]}
];
function processAsync(n) {
return new Promise(function(resolve) {
setTimeout(
function() { resolve(n * n); },
Math.random() * 1e3
);
});
}
Promise.all(arr.map(function(entity){
return Promise.all(entity.subarr.map(function(item){
return processAsync(item);
}));
})).then(function(data) {
console.log(data);
});
Also in JavaScript:
- javascript check if string is json parsable
- angular route change scroll to top
- jquery set hidden field value
- base64 decode javascript
- javascript style
- javascript extract number from string
- how to use fetch() to fetch an image from database in js
- jquery number format comma
- Ocultar o mostrar elementos HTML con JQuery
- href before onclick js
- discord.js get all members with role
- scrollview refresh
- expressjs cheat sheet
- javascript class
- scroll to top in react
- angular current year
- jquery validate conditional
- optional arguments javascript
- nodemailer
- javascript beginning of today and yesterday
- javascript replace string
- how to add script before </body> in magento 2
- js random number
- js how to reverse a string