Object.defineProperties(object, property)

Used to define new properties or properties to the existing object or to modify existing properties.

You can only call this method on Object constructor

Example 1.

  const obj = {};
  Object.defineProperties(obj, {
      proparty: {
          value: "Suhas",
          enumerable: false,
          writable: false,
          configurable: false
      }
  });

Example 2.

  const obj = {};
  Object.defineProperty(obj, "property2", {
      value: "More",
      enumerable: false,
      writable: false,
      configurable: false
      
  })

using writable property we can restrict properties from being updated.

define property example

For further reading refer MDN

Follow me on Twitter