In javascript, the typical way to new up an object is by doing it like this: new Date(). But you can also do this: new (Date). What is the difference and advantages of doing it the latter way?
In javascript, the typical way to new up an object is by doing it
Share
There is no difference.
The
newoperator takes a function reference.Like any other operator, the operand can have parentheses.
The
()after anewexpression with no arguments are optional.However, if you have more a complicated expression inside the parentheses, they can change precedence ordering, such as in this answer.