- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- 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'
Advertisements