Organizational Research By

Surprising Reserch Topic

what is the difference between new object and object literal notation


what is the difference between new object and object literal notation  using -'javascript,object,jslint'

What is the difference between this constructor-based syntax for creating an object:

person = new Object()


...and this literal syntax:

person = {
    property1 : "Hello"
};


It appears that both do the same thing, although JSLint prefers you use object literal notation.

Which one is better and why?
    

asked Sep 14, 2015 by SteGERY
0 votes
6 views



Related Hot Questions

6 Answers

0 votes
NULL
answered Sep 14, 2015 by CindiW39vgzp
0 votes
NULL
answered Sep 14, 2015 by WBNSpencerg
0 votes
NULL
answered Sep 14, 2015 by Can64R
0 votes
NULL
answered Sep 14, 2015 by TrentGambrel
0 votes
NULL
answered Sep 14, 2015 by LouGoforth
0 votes
NULL
answered Sep 14, 2015 by LorFugate

...