JavaScript Object.is() Method4 Sept 2024 | 1 min read The Object.is() method of JavaScript is used to determine whether two values are the same value. There is a special built-in method that compares values. Syntax:Parametervalue1: The first value to compare. value2: The second value to compare. Return value:This method returns a Boolean indicating whether or not the two arguments are the same value. Browser Support:
Example 1Output: false Example 2Output: false true Example 3Output: true false Next TopicJavaScript Objects |
JavaScript Object.values() Method The Object.values() returns an array which contains the given object's own enumerable property values, in the same order as that provided by a for...in loop. Syntax: Object.values(obj) Parameter: obj: It is the object whose enumerable own property values are to be returned. Return value: This method returns an array of...
1 min read
JavaScript Object.assign() Method The is used to copy the values of all enumerable own properties from one or more source objects to a target object. Objects are assigned and copied by reference. It will return the target object. Syntax: Object.assign(target, sources) Parameter target: The target object. sources: The source object(s). Return...
1 min read
JavaScript Object.create() Method The is used to create a new object with the specified prototype object and properties. We can create an object without a prototype by Object.creates (null). Syntax: Object.create(prototype[, propertiesObject]) Parameter prototype: It is the prototype object from which a new object has to be created. propertiesObject: It is...
2 min read
JavaScript Object.freeze() Method The freezes an object that ents new properties from being added to it. This method ents the modification of existing property, attributes, and values. Syntax: Object.freeze(obj) Parameter Obj: The object to freeze. Return value: This method returns the object that was passed to the function. Browser Support: Chrome 45.0 Edge 12.0 Firefox 32.0 Opera No Example 1 const object1 =...
1 min read
JavaScript Object.defineProperty() Method The defines a new property directly on an object and returns the object. To change the flags, we can use Object.defineProperty. We cannot change it back, because define property doesn?t work on non-configurable properties. Syntax: Object.defineProperty(obj, prop, descriptor) Parameter Obj: The Object on which to define the...
1 min read
JavaScript Object.defineProperties() Method The defines new or modifies existing properties directly on an object, and returning the object. Syntax: Object.defineProperties(obj, props) Parameter Obj: The object on which to define or modify properties. Props: An object whose own enumerable properties constitute descriptors for the properties to be defined or modified. Return: This method reruns...
1 min read
JavaScript Object.getOwnPropertyDescriptor() Method The Object.getOwnPropertyDescriptor method allows to query the full information about a property and returns a property descriptor for an own property (that is, one directly present on an object and not in the object's prototype chain) of a given object. Syntax: bject.getOwnPropertyDescriptor(obj, prop) Parameter obj: It is the...
1 min read
JavaScript Object.setPrototypeOf() Method The sets the prototype (i.e., the internal [[Prototype]] property) of a specified object to another object or null. All JavaScript objects inherit properties and methods from a prototype. It is generally considered the proper way to set the prototype of an object. Syntax: Object.setPrototypeOf(obj, prototype) Parameters: obj:...
2 min read
JavaScript Object.entExtensions() Method The Object.entExtensions() only ents the addition of new properties from ever being added to an object (i.e., ents future extensions to the object). This change is a permanent that means once an object has been made non-extensible, it cannot make extensible again. Syntax: Object.entExtensions(obj) Parameter: obj: It is...
1 min read
JavaScript Object.getOwnPropertyNames() Method The Object. returns an array of all properties (except those non-enumerable properties which use symbol) found directly upon a given object. Syntax: Object.getOwnPropertyNames(obj) Parameter: obj: It is the object whose enumerable and non-enumerable own properties are to be returned. Return value: This method returns an array of string that...
1 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India