Reflect.defineProperty() JavaScript

The JavaScript Reflect.defineProperty() adds or modifies a property of an object. It is the same as Object.defineProperty() but it returns a Boolean. Syntax: Reflect.defineProperty(target, propertyKey, attributes) Parameters: target: It represents the object that has to be invoked. propertyKey: It represents the name of the property to be defined or modified. attributes: It represents attributes for … Read more

Reflect.construct() JavaScript

The JavaScript Reflect.construct() method invokes a constructor with a variable number of arguments. It also provides the option to set a different prototype. Syntax: Reflect.construct(target, argumentsList[, newTarget]) Parameters: target: It represents the object that has to be invoked. argumentsList: It represents the parameters for the function. newTarget: It represents the constructor whose prototype should be … Read more

Reflect.apply() JavaScript JS

The JavaScript Reflect.apply() method calls a function using the specified argument. Note: If the target function is not callable then it will throw TypeError. Syntax: Reflect.apply(target, thisArg, arguments) Parameters: target: It represents the object that has to be invoked. thisArg: It will act as this keyword for the function. arguments: It represents the parameters for … Read more

JavaScript Reflect

There are various methods that the JavaScript Reflect object facilitates. JavaScript Reflect Methods: apply() Method: Use: To call a function using the specified argument. construct() Method: Use: To invoke a constructor with a variable number of arguments. defineProperty() Method: Use: To add or modify a property of an object. deleteProperty() Method: Use: To delete a … Read more

Object.values() JavaScript

The Javascript Object values() method retrieves an array of direct enumerable property values. Syntax: Object.values(object) Parameters: object: It represents the object whose enumerable property values have to be retrieved. Return: An array of direct enumerable property values. Example: <!DOCTYPE html> <html> <body> <script> const obj = { a: ‘TOM’, b: ‘JONAS’ }; document.write(Object.values(obj)); </script> </body> … Read more

Object.setPrototypeOf() JavaScript JS

The Javascript Object setPrototypeOf() method sets the prototype of a specified object to another object. Prototype can be another object or null. Syntax: Object.setPrototypeOf(object, prototype) Parameters: object: It represents the object whose prototype has to be set. prototype: It represents the new prototype. Return: Specified Object Example: <!DOCTYPE html> <html> <body> <script> let jewel = … Read more

Object.seal() JavaScript

The JavaScript Object seal() method prevents any new properties from being added and marks all existing properties as non-configurable. Syntax: Object.seal(object) Parameters: seal: It represents the object which has to be sealed. Return: Sealed Object. Example: <!DOCTYPE html> <html> <body> <script> const a = { prop: ‘HELLO’}; const b = Object.seal(a); b.prop = ‘WORLD’; document.write(b.prop); … Read more

Object.preventExtensions() JavaScript

The Javascript Object preventExtensions() method prevents any extensions of an object i.e. no new property can be added and no existing property can be modified. Note: Prevention on an object will be permanent and the object cannot be extensible again after applying prevention. Syntax: Object.preventExtensions(object) Parameters: object: It represents the object that has to be … Read more

Object.is() JavaScript JS

The Javascript Object is() method determines whether two values are of the same value. Syntax: Object.is(value1, value2) Parameters: value1: It represents the first value to be compared. value2: It represents the second value to be compared. Return: It returns true if two values are of the same value otherwise returns false. Two values are considered … Read more

Object.getPrototypeOf() JavaScript

The JavaScript Object getPrototypeOf() method retrieves the prototype of the specified object. It will return null if there are no inherited properties. Syntax: Object.getPrototypeOf(object) Parameters: object: It represents the prototype of the specified object. Return: Prototype of the specified object. Example: <!DOCTYPE html> <html> <body> <script> const proto = {}; const obj = Object.create(proto); document.write(Object.getPrototypeOf(obj) … Read more