Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to wait foreach javascript

var bar = new Promise((resolve, reject) => {
    foo.forEach((value, index, array) => {
        console.log(value);
        if (index === array.length -1) resolve();
    });
});

bar.then(() => {
    console.log('All done!');
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #wait #foreach #javascript
ADD COMMENT
Topic
Name
4+9 =