I'm looking through the Vows documentation and in several places it uses the syntax
var myVar = new(MyFunction);
e.g.
var promise = new(events.EventEmitter);
I am familiar with new MyFunction()
and new MyFunction
(and yes, I have read this question). But the syntax above is, well, new to me - it looks like a function call, though I suspect it's just new MyFunction
with some added parentheses. Is there any difference between these ways of using new
? If not, is there any good argument for using one or the other? I would have thought new MyFunction()
was the most legible.
Apologies if this is a duplicate - I searched but couldn't find it.