Open In App

How to Create an Empty Object in JavaScript ?

Last Updated : 29 Jan, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

In JavaScript, We can create an empty object using curly braces {} and the Object constructor.

Example: Using curly braces {} and we are not intializing with any value as we want an empty object.

Javascript




let emptyObject = {};


Example: Using Object constructor.

Javascript




let anotherEmptyObject = new Object();


Both approaches result in the creation of an empty object. Once you have an empty object, you can later add properties and values to it as needed.


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads