defineProperties < Object < JavaScript
The Object defineProperties() static method adds or modifies properties on an object and returns the object.
const obj = {};
Object.defineProperties(obj, {
property1: {
value: 42,
writable: true,
},
property2: {
value: "Hello",
writable: false,
},
});
console.log(obj.property1);
// 42