Which prototypes will be setted into the following objects?
 var obj1 = new Object(); 
 var obj2 = {}; 
 var obj3 = Object.create(null);
All objects in JavaScript are descended from Object; all objects inherit methods and properties from Object.prototype, although they may be overridden (except an Object with a null prototype, i.e. Object.create(null))
Declaring obj1 = {} and obj2 = new Object() are the same, because {} used to create new Object.
Object.create(null) doesn't inherit from anywhere and thus has no properties at all.
In other words. a javascript object inherits from Object by default, unless you explicitly create it specifying null as its prototype, as in Object.create(null)

Changed, we hope it is better now. Thanks, @docahrens

2016 Jun 15, 6:36:08 PM

Very poorly worded question. What represent the "properties" and which represent the objects? Are you saying null is a property? null is an Object... Your question is misleading/confusing

2016 Jun 10, 10:37:07 PM

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Sign Up Now
or Subscribe for future quizzes