I saw this 'erroneous' calling of new
keyword on Promise.resolve
, but I am surprised that it works! Can someone please explain to me what is happening, and if it is different in any way to omitting the new
keyword?
new Promise.resolve(1)
Looking at the MDN documentations for operator precedence (specifically Member Access, Function Call and new(without argument list)) and new
keyword, shouldn't the above throw error, since I assume the expression is getting evaluated like such:
new (Promise.resolve(1))
I think I am missing something (obvious) here. Thanks in advance!
Note: Using bluebird library 2.x