Creating a null object is simple, but not in the way you may think.

Consider the below code -

const earth = {};

earth is empty but not null.

See -

console.log(Object.toString(earth));
// function Object() { [native code] }

console.log(earth.__proto__);
// {}

console.log(earth.hasOwnProperty());
// false

console.log(Object.getOwnPropertyDescriptors(earth));
// {}

If you want a truly empty object, you would want to do this -

const nullEarth = Object.create(null);

Now the previously tested code yields different results -

console.log(Object.toString(nullEarth));
// function Object() { [native code] }

console.log(nullEarth.__proto__);
// undefined

console.log(nullEarth.hasOwnProperty());
// error: nullEarth.hasOwnProperty is not a function

console.log(Object.getOwnPropertyDescriptors(nullEarth));
// {}

The new object is an object all right, but does not have a property and inherits from undefined rather than an empty object.