Object Methods
Object methods help you look at keys, values, and pairs.
You can also copy or freeze objects with helpers.
Think of an object as a labeled drawer. These tools open the labels.
Object.keys
Object.values
Object.entries
Object.assign
Methods on your own objects
Object.keys
This returns an array of key names.
Object.values
This returns an array of the values.
Object.entries
This returns pairs like [key, value].
Great for looping through both.
Object.assign
This copies properties from one object into another.
Your own methods
A method is a function stored as an object property.
Inside, this can mean the object itself.
hasOwnProperty
This asks if the object has its own key.
Tip: keys, values, and entries turn objects into arrays. Then you can use array tools.
Test yourself
Three quick questions made just for this lesson. Earn 10 XP per correct answer.