Key Concepts

Review core concepts you need to learn to master this subject

Objects
Lesson 1 of 2
  1. 1
    It’s time to learn more about the basic structure that permeates nearly every aspect of JavaScript programming: objects. You’re probably already more comfortable with objects than you think, becau…
  2. 2
    Objects can be assigned to variables just like any JavaScript type. We use curly braces, {}, to designate an object literal: let spaceship = {}; // spaceship is an empty object We fill an object…
  3. 3
    There are two ways we can access an object’s property. Let’s explore the first way— dot notation, .. You’ve used dot notation to access the properties and methods of built-in objects and dat…
  4. 4
    The second way to access a key’s value is by using bracket notation, [ ]. You’ve used bracket notation when indexing an array: [‘A’, ‘B’, ‘C’][0]; // Returns ‘A’ To use bracket notation to access…
  5. 5
    Once we’ve defined an object, we’re not stuck with all the properties we wrote. Objects are mutable meaning we can update them after we create them! We can use either dot notation, ., or bracke…
  6. 6
    When the data stored on an object is a function we call that a method. A property is what an object has, while a method is what an object does. Do object methods seem familiar? That’s because y…
  7. 7
    In application code, objects are often nested— an object might have another object as a property which in turn could have a property that’s an array of even more objects! In our spaceship o…
  8. 8
    Objects are passed by reference. This means when we pass a variable assigned to an object into a function as an argument, the computer interprets the parameter name as pointing to the space in me…
  9. 9
    Loops are programming tools that repeat a block of code until a condition is met. We learned how to iterate through arrays using their numerical indexing, but the key-value pairs in objects aren’t …
  10. 10
    Way to go! You’re well on your way to understanding the mechanics of objects in JavaScript. By building your own objects, you will have a better understanding of how JavaScript built-in objects wor…

What you'll create

Portfolio projects that showcase your new skills

Pro Logo

How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory

Pro Logo