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 JavaScript Loops, Arrays and Objects Tracking Data Using Objects Mixing and Matching Arrays and Objects

Learning coding
seal-mask
.a{fill-rule:evenodd;}techdegree
Learning coding
Front End Web Development Techdegree Student 9,937 Points

Foggy about "property" and "keys".

Objects are also great. 0:06 They provide a way to structure data that's easy to read and 0:10 retrieve using a property name or a key.

So you van retrieve data with a property, or key. Are property and keys the same, or are they different methods to retrieve data?

2 Answers

Seth Kroger
Seth Kroger
56,413 Points

"Key" is a more general term because key-value pairs are used in a lot of places in programming/computer science than just objects. "Property" is more specific to objects and OOP, no matter the language, with "key" being the name of the property.

Victor Learned
Victor Learned
6,976 Points
var object = { 'name' : 5 };

Property is the part of object named "name" with value 5. Key is the word "name". Specifically property refers to the key-value relationship of an object.

Here's an official property defintion from the MDN docs: https://developer.mozilla.org/en-US/docs/Glossary/property/JavaScript