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 JavaScript Loops, Arrays and Objects Tracking Data Using Objects The Object Literal

Nicholas Wallen
Nicholas Wallen
12,278 Points

What's the difference between a key and a property, if they both equal "value"?

See above.

2 Answers

Tyler Durden
Tyler Durden
2,406 Points

if you learn any other languages, like JAVA for example, it will make wayyy more sense and be very intuitive (probably why programmers usually reiterate that when you learn other languages, the subsequent are much easier and you can have "eureka" moments).

The way you do it in Java is

/* public class called Students , with instance variables of String, int, and float */
public class Students  {
String name;
int age;
float grades;

/* constructor to initialize the instance variables to values, i.e. making the age equal to 17 etc.. */
public Students () {
name = "John";
age = 17;
grades = 99.9f;


you can see how analogous it is to Javascript, the key is just like name and the property is the actual value, in this case "John". Anyway, hope that didn't confuse ya and it's probably not the best example. I actually like the way OOP (object orientated) is done in Java, but maybe because its a more a pure OOP language or maybe I'm just biased that was one of my first languages.