[Go to site: main page, start]

0% found this document useful (0 votes)
35 views1 page

JavaScript Object Methods Guide

This cheat sheet provides a concise overview of various JavaScript object methods and their purposes. It includes examples for methods such as Object.keys, Object.values, Object.assign, and more, demonstrating how to manipulate and interact with objects. Each method is clearly defined with its functionality and a practical example for better understanding.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views1 page

JavaScript Object Methods Guide

This cheat sheet provides a concise overview of various JavaScript object methods and their purposes. It includes examples for methods such as Object.keys, Object.values, Object.assign, and more, demonstrating how to manipulate and interact with objects. Each method is clearly defined with its functionality and a practical example for better understanding.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

JavaScript Object Methods Cheat Sheet

Method / Operation Purpose Example

[Link](obj) Get all keys (property names) [Link]({a:1,b:2}) → ["a","b"]

[Link](obj) Get all values [Link]({a:1,b:2}) → [1,2]

[Link](obj) Get key/value pairs [Link]({a:1,b:2}) → [["a",1],["b",2]]

[Link](target, ...sources) Copy / merge properties [Link]({}, {a:1}, {b:2}) → {a:1,b:2}

[Link](obj) Make object fully immutable [Link](user)

[Link](obj) Prevent add/remove, but allow value edits [Link](car)

[Link](proto) Create new object inheriting from another [Link](parentObj)

[Link](obj, prop) Check if property exists directly on object [Link](user, "name") → true

[Link](prop) Legacy version of above (instance method) [Link]("name") → true

[Link](obj) Get all property names (even non-enumerable)


[Link](Math)

[Link](obj, prop, descriptor)Manually define a property (e.g., non-writable)[Link](obj,"id",{value:1})

[Link](arr) Convert [key,value] pairs → object [Link]([["a",1],["b",2]])

delete [Link] Remove a property from the object delete [Link]

[Link](obj) Get the prototype of an object [Link](child)

[Link](obj, proto) Set the prototype of an object [Link](child, parent)

You might also like