Questions Objects and their syntax


#1

In the instructions, the Object Constructor syntax is this:

var myObj = new Object();
     myObj.property = "property";

But I keep seeing in their examples omiting the newObject(); keyword like var myObj = {};.
Is there a difference between the two?

My next question is am I able to next an object constructor within another object constructor? Like the Contact List exercise of having object friends then having specific names. I would like to use the Object Constructor for those specific people's properties too.


#2

@megacoder39472,

The result of new Object() or {} is the same, a =new-empty-Object=
( but in the 'outer-world' it is advised to use the {} statement, as with the 'new Object()' you will open a possibillity for 'hacker code insertion' )

google search
== discussions / opinions ==
javascript new object vs object literal site:stackoverflow.com