Junior JavaScript

What is the difference between new Object() and object literal {}?

Both create objects, but:

  • {} is simpler and faster.
  • new Object() is less common and can be overridden.

Example:

const a = {}; // Preferred

const b = new Object(); // Not preferred

More from JavaScript Tutorial

All questions for this course