javascript return new Promise: short syntax
When working with asynchronious javascript every second function looks like this: function_name() { return new Promise((resolve,reject) => { // do some async task resolve(); }); } Even with es6 async/await I cannot avoid the part "return new Promise((resolve,reject) => { ...". Is there another way of writing such code without all those duplicated lines? Thanks. First off, you should be avoiding the promise anti-pattern that wraps a new promise around other functions that already return promises. If you're doing that, then you can just stop doing that entirely and just return the promise that