Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript Object-Oriented JavaScript (2015) Introduction to Methods Different Kinds of Objects

Nelson Lee
Nelson Lee
6,853 Points

Values stored in objects are called

This should be key value pair. however its wrong

3 Answers

Steven Parker
Steven Parker
221,046 Points

:warning: SPOILER ALERT


Only certain kinds of objects (dictionaries, for example) have key/value pairs.

:point_right: The more general term for object values is "properties".

Steven Parker I appreciate your humor here along w. the information. Are you a Dr. Who fan? There are many "spoilers" from River Song too. ;)

Steven Parker
Steven Parker
221,046 Points

Sure, I enjoy Dr. Who, but I wasn't thinking of it when I wrote that.

By "spoiler" I just meant that it gives away the exact answer to the quiz question.

After 4 months, are you just now getting back to the course? :hourglass:

Julie Myers
Julie Myers
7,627 Points

In general an object in javaScript is said to be made up of key/value pairs. These key/value pairs can either be properties or methods. For example:

var friends = {
  firstName: "Jack",
  lastName: "Apple",
  getFullName: function() {
    console.log("My friends name is: " + this.firstName + " " + this.lastName);
  }
}

/*
firstName and lastName are properties of the object friends.
getFullName is a method of the object friends.

firstName is the key. "Jack" is the value.
lastName is the key. "Apple" is the value.
getFullName is the key. The anonymous function is the value.
*/

It takes a while to get used to how the terms in a programming language are used. You'll get used to it.