0

I'm fairly new to JavaScript, and just getting into objects. I'm curious if there's any reason (aside from potential readability) why one would use constructor notation to make an object instead of literal notation.

As I understand it this (literal):

var obj = {};

...is the same as this (constructor):

var obj = new Object();

Literal seems far more compact, but constructor looks a bit clearer for others reading through. Is there another reason I haven't yet come across why one may be superior to the other?

Thanks!

Brad
  • 359
  • 4
  • 12
  • There is no - the outcome is the same. "but constructor looks a bit clearer" --- it does not. – zerkms Jan 14 '16 at 02:03
  • 1
    I'm quite sure there are multiple duplicates of this question. I'll have to go see if I can find one. – jfriend00 Jan 14 '16 at 02:04
  • Another dup: [Why does JavaScript have different declarations for the same behavior?](http://stackoverflow.com/questions/11588323/why-does-javascript-have-different-declarations-for-the-same-behavior/11588393#11588393) – jfriend00 Jan 14 '16 at 02:08

0 Answers0