
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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 Questions & Answers
- 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 the difference between Object oriented programming and Object based programming?
- What is the difference between rest parameters and the arguments object in Javascript?
- What is difference between instantiating a C++ object using new vs. without new?
- What is the difference between class and object in Java?
- What is the difference between object and reference in java?
- What is the difference between a String object and a StringBuffer object 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#?
- What is the difference between dynamic type variables and object type variables?
- Difference between mutable and immutable object
- Object difference in JavaScript
Advertisements