Object.getOwnPropertySymbols() JavaScript JS

The Javascript Object getOwnPropertySymbols() method retrieves an array of all its own symbol key properties. It will return an empty array if no symbol property is directly associated with an object. Syntax: Object.getOwnPropertySymbols(object) Parameters: object: It represents the object whose symbol properties have to be fetched. Return: An array of all own symbol key properties. … Read more

Object.getOwnPropertyNames() JavaScript

The Javascript Object getOwnPropertyNames() method retrieves an array of all direct properties of the object. It will exclude non-enumerable properties which use symbols. Syntax: Object.getOwnPropertyNames(object) Parameters: object: It represents the object whose all direct properties have to be fetched. Return: An array of all direct properties of the object. Example: <!DOCTYPE html> <html> <body> <script> … Read more

Object.getOwnPropertyDescriptors() JavaScript JS

The Javascript Object getOwnPropertyDescriptors() method retrieves all own property descriptors of an object. It will return an empty object if there is no property associated with the Object. Syntax: Object.getOwnPropertyDescriptors(object) Parameters: object: It represents the object whose own property descriptors have to be fetched. Return: All own property descriptors of the specified object. Example: <!DOCTYPE … Read more

Object.getOwnPropertyDescriptor() JavaScript JS

The Javascript Object getOwnPropertyDescriptor() method retrieves a property descriptor for the specified property of the specified object. Syntax: Object.getOwnPropertyDescriptor(object, property) Parameters: object: It represents the object whose property descriptor has to be fetched. Return: A property descriptor for the specified property. Example: <!DOCTYPE html> <html> <body> <script> const obj = { prop: 56 } const … Read more

Object.freeze() JavaScript

The JavaScript Object freeze() method prevents existing properties from being modified and the new properties from being added on the specific object. Syntax: Object.freeze(object) Parameters: object: It represents the object on which new properties are to be added or modified. Return: Given object. Example: <!DOCTYPE html> <html> <body> <script> const obj = { prop: 56 … Read more

Object.entries() JavaScript

The Javascript Object entries() method gives an array with enumerable property key-value pairs of a specified object. Syntax: Object.entries(object) Parameters: object: It represents the object whose enumerable property key-value pairs have to be get. Return: An array with enumerable property key-value pairs. Example: <!DOCTYPE html> <html> <body> <script> const a = { 10: ‘BRONZE’, 20: … Read more

Object.defineProperties() JavaScript JS

The Javascript Object defineProperties() method is used to add or modify multiple object properties. Syntax: 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. Example: <!DOCTYPE html> <html> <body> <script> const … Read more

Object.defineProperty() JavaScript

The Javascript Object defineProperty() method describes the behavioral attributes of the property. It is used to add a new property or change or modify an existing property directly to a specified object and returns the object. Syntax: Object.defineProperty(object, property, descriptor) Parameters: object: It represents the object to which the new property will be defined. property: … Read more

Object.create() JavaScript

The Javascript Object create() method creates a new object with the specified prototype object and properties. Syntax: Object.create(prototype[, propertiesObj] Parameters: prototype: It represents the target object. It is a required parameter. propertiesObj: It represents enumerable properties that will be added to a newly created object. It is an optional parameter. Return: A new object with … Read more

Object.assign() JavaScript

The Javascript Object assign() method copies enumerable and own properties from a source object to a target object. The whole operation (assignment and copy) is done by reference. Syntax: Object.assign(target, sources) Parameters: target: It represents the target object. source: It represents the source object. Return: It returns the target object. Example: <!DOCTYPE html> <html> <body> … Read more