views:

138

answers:

2

Both syntaxes are equivalent (at least I suppose they are).

let o1 = new Object()

or

let o2 = Object()

Which way do you use more often? What about readability issues?

+4  A: 

They are the same.

I prefer using 'new', with little good reason other than it is what I am accustomed to in other languages, and it makes it easier to findstr/grep for constructor calls (lacking smart tools to 'find all references' in a solution).

Brian
Seems the best option, yes.
Stringer Bell
+7  A: 

I feel like omitting "new" is a bit more functional, so that's my preference. I like that you can treat a constructor just like any other function returning an instance of a type.

kvb
Would make sense too.. I think the important stuff is to make a choice and then conform to it.
Stringer Bell