How to Create an Empty Object in JavaScript ?
Last Updated :
29 Jan, 2024
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.
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.
Share your thoughts in the comments
Please Login to comment...