Marko Marko - 1 year ago 101
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) { 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download