Object, key, property and value


what are objects, keys, properties, and values? I dont 100% understand the term, especially keys and properties, i find it kind of confusing, thank you!!!!

var friends = new Object();

friends.steve = {
    firstName: "Steve",
    lastName: "Smith",
    number: '123'

friends.bill = {
    firstName: "Bill",
    lastName: "Chan",
    number: '456'
<do not remove the three backticks below>


yea, with this code it can be a bit confusing, if we have something simple like:

var example = new Object();
example.property1 = "value1"
example.property2 = "value2"
example.property3 = "value3"

example is clearly the object. property1, property2 and property3 are clearly the properties of example object. And you can guess what the values are.

With your code, things get a little more confusing. lets start with the obvious. friends is an object. friends has two properties, steve and bill, both properties have a value.

but the confusing thing is, that steve and bill (our properties) are also objects. steve (and bill) have each 3 properties (firstName, lastName and number) (the properties obviously have a value)


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.