Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
5 views

JavaScript Object Functions

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

JavaScript Object Functions

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

JavaScript

JavaScript Object Functions


Object.keys()
Extracts all property names (keys) from an object
and returns them as an array. Ideal for iterating
over object properties.

Object.values()
Extracts all values from an object and returns
them as an array.
Object.entries()
Converts the object into an array of [key, value]
pairs. Useful for iterating over both keys and
values.

Object.fromEntries()
Converts an array of [key, value] pairs back into
an object.
Object.assign()
Copies properties from source objects into a
target object. Often used for shallow cloning or
merging objects.
Object.freeze()
Makes an object immutable, meaning you can’t
add, remove, or change its properties.

Object.seal()
Prevents adding or removing properties but
allows modifications to existing ones.
Object.hasOwn()
Checks if the object has a specified property
directly, ignoring inherited properties.

Object.is()
Compares two values to check if they are the
same. Fixes edge cases where === fails (e.g., NaN).
Object.getOwnPropertyDescriptors()
Returns detailed metadata about an object’s
properties, such as value, writable, and
enumerable.
🌟 Advanced Use Cases
Combine these functions for powerful
workflows:

You might also like