22/30 How do I wrap my head around this?


#1

Maybe I'm picking on a super minor stuff here but .. Aren't line 2 and 3 supposed to have "," instead of ";"? Also on line 4 nothing at all instead of ";"?

===============
Revised: after finishing 23/30:
Now above mentioned syntax (where having "," all the way except in last line within {} of constructor is not working with var (private variable) at in the last line. I guess I could just use ";"'s all the way?


#2

Could you display the code you are writing about...
and point out the locations where you have the question.....


#3

Not super minor at all, good question. Fare warning, this explanation will come from my relatively elementary understanding of object-oriented programming concepts.

Semicolons are used on lines 2 and 3 because you are instantiating the values of the properties for the Person constructor.

You use commas when you are enumerating the properties of an object after you define an object. Properties belong to an object, whereas the arguments are values passed to the object's constructor.

The first lesson of the "Introduction to Objects II" conveniently shows these two concepts side-by-side and probably illustrates the differences much better than my explanation.

Cheers,