Difference between Promise returned with or without keyword 'new'

They both seemed to work, but what is the difference between:

return await new Promise.all([p1, p2])
                .then(value => console.log(value))


return await Promise.all([p1, p2])
                .then(value => console.log(value))

Especially if I am going to be calling the promise function within a cron job? Will one take up more resources than another? Eventually to having to set

const EventEmitter = require('events').EventEmitter;
const emitter = new EventEmitter();
emitter.setMaxListeners(100);

Strange, in this babel repl, I get

TypeError: Promise.all is not a constructor

in console

1 Like