Object.defineProperties() JavaScript JS

The Javascript Object defineProperties() method is used to add or modify multiple object properties.


Object.defineProperties(object, properties)

Parameters: object: It represents the object on which multiple properties have to be added or modified. properties: It represents the properties that have to be added or modified.

Return: Modified object.


<!DOCTYPE html>
const obj = {};
Object.defineProperties(obj, { prop1: {value: 56},
prop2: {value: 65}});
document.write(obj.prop1 + "<br>")
Please follow and like us:
Content Protection by DMCA.com