Marko Marko - 10 months ago 60
Javascript Question

Javascript promise - replace arrow functions

Since the support for arrow functions in JS is still quite low, I'd like to replace them from the following code snippet:

Promise.all([f1(), f2()])
.then(values => { f3(values); })
.catch(values => { f4(values); });

Any idea how can this be achieved?

Answer Source

Should be straight forward, just type "function" instead

Promise.all([f1(), f2()]).then(function(values) { 
}).catch(function(values) {