Order of properties?


#1

I just got started in this section and I was wondering something. Here's a snippet of the code they start us off with:

var friends = {};
friends.bill = {
  firstName: "Bill",
  lastName: "Gates",
  number: "(206) 555-5555",
  address: ['One Microsoft Way','Redmond','WA','98052']
};
friends.steve = {
  firstName: "Steve",
  lastName: "Jobs",
  number: "(408) 555-5555",
  address: ['1 Infinite Loop','Cupertino','CA','95014']
};

Would it make a difference if the properties were ordered differently? For example:

var friends = {}
friends.bill = {
  firstName: "Bill",
  lastName: "Gates",
  number: "(206) 555-5555",
  address: ['One Microsoft Way','Redmond','WA','98052']
}
friends.steve = {
  number: "(408) 555-5555",
  firstName: "Steve",
  address: ['1 Infinite Loop','Cupertino','CA','95014']
  lastName: "Jobs",
}

Also, why do I see semi-colons after the closing braces? I never do that and it's never given me trouble for it. That just seems redundant.


#2

I don't believe it will make a difference if the properties are ordered differently. As for the semicolon right after the curly braces then I believe that it is just part of it's syntax and that if you took them away then it would give you a syntax error.

What I suggest is that you play around with this sort of stuff in the Codecademy labs where you can experiment on these kinds of things.


#3

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