Summary: Objects
Review what we learned about objects in JavaScript.
We'll cover the following
Key points
-
Objects have properties that contain information about the object and methods that are actions the object can perform.
-
Object literals in JavaScript are a collection of key–value pairs placed inside curly braces (
{}
) and separated by commas. -
Properties can be strings, numbers, Booleans or arrays.
-
Methods are stored as functions.
-
An object’s properties and methods can be accessed using either dot notation or square bracket notation.
-
Objects are mutable, which means that their properties and methods can be changed or removed (even if they’re created using
const
.) -
Nested objects can be created by placing objects inside objects.
-
The keyword
this
can be used in properties and methods to refer to the object itself.
Now that we’ve learned about all the basics of programming, after the quiz and challenge we’ll look at how our code can interact with the browser environment.
Get hands-on with 1400+ tech skills courses.