
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
What is the difference between `new Object()` and object literal notation in JavaScript?
Both new Object() notation and Object literal({}) notations do the same thing. They initialize an object. However, the second notation can be a little different if you start adding properties to it.
Example
let a = { name: 'Ayush' }
This initialization is equivalent to −
let a = new Object(); a.name = 'Ayush'
or
let a = {} a.name = 'Ayush'
- Related Articles
- What is the difference between new operator and object() constructor in JavaScript?
- What is the difference between a String object and a String literal in Java?
- What is the main difference between objects created using object literal and constructor function?
- What is difference between instantiating a C++ object using new vs. without new?
- What is the difference between rest parameters and the arguments object in Javascript?
- What is the difference between Object oriented programming and Object based programming?
- What is the difference between a String object and a StringBuffer object in java?
- What is the difference between object and reference in java?
- What is the difference between literal and constant in C++?
- What is the difference between literal and constant in C#?
- What is the difference between a class and an object in C#?
- Safely setting object properties with dot notation strings in JavaScript
- Object difference in JavaScript
- What is the difference between dynamic type variables and object type variables?
- What is the difference between a shadow and image of an object?

Advertisements