Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Object-Oriented JavaScript (2015) Introduction to Methods Modifying Objects with Methods

so do i have this right

var calculater = {
sum: 0,
add: function (value) {
this.sum += value;
}
}

var calculater is the object literal, sum is the property, add: is the key, function (value) is the method.

Joren Paridaens
Joren Paridaens
1,602 Points

That seems correct terminology to me!

1 Answer

Caleb Sanchez
Caleb Sanchez
12,943 Points

calculator is the object sum is a property of the calculator object. add is the key as part of the "key: value" pair - add: function the value of add is a function. add is a method you can call on the calculator object.

I think you've got it all down.