0PricingLogin
Javascript for Kids · Lesson

Changing Properties

Update an object.

Swapping Treasures 🔄

What if your dog has a birthday 🎂? Its age should change!

Good news: we can change a treasure inside an object any time we want.

Use the Dot and Equals 🟰

To change a treasure, use the dot to point at it, then = to give it a new value.

Like saying: dog DOT age, you are now 5!

let dog = { name: 'Rex', age: 4 }
dog.age = 5
console.log(dog.age)

All lessons in this course

  1. What Is an Object?
  2. Reading Properties
  3. Changing Properties
  4. A Pet Object
← Back to Javascript for Kids