Articles → JavaScript → Difference Between New Object() And {} In JavascriptDifference Between New Object() And {} In JavascriptIn this article, we will discuss the difference between new Object() Vs {} in JavaScript.Consider the following examplevar obj = new Object(); var obj1 = { name: "karan" }In the first line of code, I am creating an object and in the second line of code I am creating an object and assign one property ‘name’ to it.It is always better to use second statement because you can perform multiple activities (object creation and property assignment) in less code space.Posted By - Karan Gupta Posted On - Tuesday, November 28, 2017 Query/Feedback Your Email Id** Subject* Query/Feedback Characters remaining 250**
var obj = new Object(); var obj1 = { name: "karan" }
Query/Feedback