Yes, it's a shallow clone issue. You can test this in your browser console (create a New Tab, and go to the browser's Developer Console):

const a = { b: { c: 'hello world' } };
const b = Object.create(a);
console.log(b); // {}

You need to use a deep-clone technique in order to recreate your object.

Answer from sfdcfox on Stack Exchange
🌐
Alex MacArthur
macarthur.me › posts › remember-to-probably-target-an-empty-object-with-object-assign
Remember to Probably Target an Empty Object with Object.assign() | Alex MacArthur
March 4, 2023 - The method makes no promises to not mutate that target object. It’ll copy over properties to it and spit it that mutated version back to you. Obviously, the solution to this is pretty simple. Pass a new, empty object as the target, and you’re good to go:
Discussions

[jQuery] Creating an empty jQuery object
I've been using jQuery for a few months now, trying to convert all my hand-rolled javascript and came across a minor problem that I could not find documented anywhere: I want to create DOM elements and add them into a jQuery object, as in; var result = [empty jQuery object]; $.each(... var ... More on forum.jquery.com
🌐 forum.jquery.com
arrays - Create an empty object in JavaScript with {} or new Object()? - Stack Overflow
Many authors recommend not to use the object constructor when you can use a certain literal notation instead, where you will be sure that what you're creating is what you're expecting to have in your code. I suggest you to do a further reading on the differences between literal notation and constructors on javascript ... More on stackoverflow.com
🌐 stackoverflow.com
Adding empty properties to an object
Based on some googling, I think I’m on the right track but, just want to confirm… The prompt asks us to “Add a "bark" property to the object myDog and set it to a dog sound, such as “woof”.” So the solution is My question: if I were to just write myDog.bark; would that create an ... More on forum.freecodecamp.org
🌐 forum.freecodecamp.org
0
0
January 9, 2020
How to initialise an empty object?
const obj = {}; More on reddit.com
🌐 r/learnjavascript
5
1
December 15, 2020
🌐
PHP Freaks
forums.phpfreaks.com › client side › javascript help
How to Push an Empty Array into an Object - Javascript Help - PHP Freaks
November 16, 2022 - I have an object that contains arrays and other elements. I need to add an array to that object but I cannot figure out how to do that. This is what I tried: json_array.push(excludes[]); Can someone give me the correct syntax? TIA.
🌐
Mercury
mercury.com › blog › creating-an-emptyobject-type-in-typescript
Creating an EmptyObject type in TypeScript | Mercury
September 19, 2023 - The {} type in TypeScript is “special” in that it allows any Plain Old Javascript Object (POJO), with any number of excess properties, to be assigned to it — even if you directly assign a non-empty object to it:
🌐
Jquery
forum.jquery.com › portal › en › community › topic › jquery-creating-an-empty-jquery-object
[jQuery] Creating an empty jQuery object
I've been using jQuery for a few months now, trying to convert all my hand-rolled javascript and came across a minor problem that I could not find documented anywhere: I want to create DOM elements and add them into a jQuery object, as in; var result = [empty jQuery object]; $.each(... var ...
🌐
Sprintchase
sprintchase.com › home › creating an empty object in javascript
Creating an Empty Object in JavaScript
June 5, 2025 - You can use the Object.create() method to create an empty object without a prototype by passing a “null” argument.
Find elsewhere
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Object › create
Object.create() - JavaScript | MDN
July 10, 2025 - o = {}; // Is equivalent to: o = Object.create(Object.prototype); o = Object.create(Object.prototype, { // foo is a regular data property foo: { writable: true, configurable: true, value: "hello", }, // bar is an accessor property bar: { configurable: false, get() { return 10; }, set(value) { console.log("Setting `o.bar` to", value); }, }, }); // Create a new object whose prototype is a new, empty // object and add a single property 'p', with value 42....
🌐
Medium
easierly.medium.com › creating-empty-object-in-javascript-8ec88fbb917f
Creating empty objects in JavaScript… | by Hassan Mustafa | Medium
May 25, 2022 - Creating empty objects in JavaScript… Every time you create an object in JavaScript either with the object literal ({}) or using “new Object()” behind the scene JavaScript invokes the …
🌐
JavaScript.info
javascript.info › tutorial › the javascript language › objects: the basics
Objects
February 17, 2026 - An object can be created with curly braces {…} with an optional list of properties. A property is a “key: value” pair, where key is a string (also called a “property name”), and value can be anything. We can imagine an object as a cabinet with signed files. Every piece of data is stored in its file by the key. It’s easy to find a file by its name or add/remove a file. An empty object (“empty cabinet”) can be created using one of two syntaxes:
🌐
Sentry
sentry.io › sentry answers › javascript › how do i test for an empty javascript object?
How do I Test for an Empty JavaScript Object? | Sentry
This method was used as an alternative to using Object.keys before it was added to JavaScript in the 2011 ECMAScript 5 specification and is widely supported by browsers. You can use JSON.stringify() to convert the value to a JSON string to check if the value is an empty object.
Top answer
1 of 10
522

Objects

There is no benefit to using new Object(), whereas {} can make your code more compact, and more readable.

For defining empty objects they're technically the same. The {} syntax is shorter, neater (less Java-ish), and allows you to instantly populate the object inline - like so:

var myObject = {
  title: 'Frog',
  url: '/img/picture.jpg',
  width: 300,
  height: 200
};

Arrays

For arrays, there's similarly almost no benefit to ever using new Array() over [] — with one minor exception:

var emptyArray = new Array(100);

creates a 100 item long array with all slots containing undefined, which may be nice/useful in certain situations (such as (new Array(9)).join('Na-Na ') + 'Batman!').

My recommendation

  1. Never use new Object(); — it's clunkier than {} and looks silly.
  2. Always use [] — except when you need to quickly create an "empty" array with a predefined length.
2 of 10
108

Yes, There is a difference, they're not the same. It's true that you'll get the same results but the engine works in a different way for both of them. One of them is an object literal, and the other one is a constructor, two different ways of creating an object in javascript.

var objectA = {} //This is an object literal

var objectB = new Object() //This is the object constructor

In JS everything is an object, but you should be aware about the following thing with new Object(): It can receive a parameter, and depending on that parameter, it will create a string, a number, or just an empty object.

For example: new Object(1), will return a Number. new Object("hello") will return a string, it means that the object constructor can delegate -depending on the parameter- the object creation to other constructors like string, number, etc... It's highly important to keep this in mind when you're managing dynamic data to create objects..

Many authors recommend not to use the object constructor when you can use a certain literal notation instead, where you will be sure that what you're creating is what you're expecting to have in your code.

I suggest you to do a further reading on the differences between literal notation and constructors on javascript to find more details.

🌐
freeCodeCamp
forum.freecodecamp.org › javascript
Adding empty properties to an object - JavaScript - The freeCodeCamp Forum
January 9, 2020 - Based on some googling, I think I’m on the right track but, just want to confirm… The prompt asks us to “Add a "bark" property to the object myDog and set it to a dog sound, such as “woof”.” So the solution is myDog…
🌐
Reddit
reddit.com › r/learnjavascript › how to initialise an empty object?
r/learnjavascript on Reddit: How to initialise an empty object?
December 15, 2020 -

I have following scenario. I have an array of objects. I loop through the array and based on value of one object i want to initialise an object. Whats the best approach to do this.

Note: I initialised the object with empty string and it works but I wanted to know if there is any better approach.

🌐
freeCodeCamp
forum.freecodecamp.org › javascript
Empty objects in javascript - JavaScript - The freeCodeCamp Forum
October 22, 2022 - For example this code has an empty object baz why? I dont understand the purpose of creating an empty object Im sure its simple concept. Thanks var object = { foo: 1, “bar”: “some string”, baz: { } };
🌐
W3Schools
w3schools.com › js › tryit.asp
Creating JavaScript Objects
The W3Schools online code editor allows you to edit code and view the result in your browser
🌐
W3Schools
w3schools.com › js › js_objects.asp
JavaScript Objects
To create an object type we use an object constructor function.
🌐
Quora
quora.com › What-is-the-method-for-creating-an-empty-object-in-JavaScript-without-inheriting-from-an-existing-object
What is the method for creating an empty object in JavaScript without inheriting from an existing object? - Quora
Here are a few examples of creating objects in JavaScript ... Object literal notation: You can use curly braces {} to create an empty object, and then add properties and methods to it.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Object
Object - JavaScript | MDN
Almost all objects in JavaScript ultimately inherit from Object.prototype (see inheritance and the prototype chain). However, you may create null-prototype objects using Object.create(null) or the object initializer syntax with __proto__: null (note: the __proto__ key in object literals is ...
🌐
Medium
sean-xiao.medium.com › why-you-should-use-instead-of-object-create-null-be22838c3038
Why you should use {} instead of Object.create(null) | by Sean | Medium
June 9, 2023 - Why you should use {} instead of Object.create(null) In my time, I have noticed some controversy over whether to use {} or Object.create(null) to create an empty object so I’m writing this article …
🌐
Mozilla
developer.mozilla.org › en-US › docs › Web › JavaScript › Guide › Working_with_objects
Working with objects - JavaScript | MDN
February 21, 2026 - In the same way, JavaScript objects can have properties, which define their characteristics. In addition to objects that are predefined in the browser, you can define your own objects. This chapter describes how to use objects, properties, and methods, and how to create your own objects.