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 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.