Craig and SparkOut are dead on, I purposely left multi dimensional arrays out of the equation initially, since
a.) I don't know your familiarity with them and...
b.) property sets are very similar, but far easier to visualize (since you can create them right in the inspector) and ...
c.) you initially asked about inheritance, which the closest I could think of would be cps, an array is an array no matter what language your in.
As far as knowing which item is which goes, you'd have to know that in any programming language far as I know, and this is no different in how you can structure it. For instance, a cp *
could* be formatted like your first example, containing nothing more than ....
Code: Select all
"Bob", "Smith", "2000-01-01", "2020-01-04", 80000, "Marketing", "Belinda Heffenrucker"
although I would certainly suggest uniformity in data storage (each item except salary is a literal string, for instance)...
...
or like your last example, where everything is on it's own line...
Code: Select all
first: "Bob",
last: "Smith",
dob: "2000-01-01",
hired: "2020-01-04",
salary: 80000,
role: "Marketing",
boss: "Belinda Heffenrucker"
without having to go to js or some other language. Format it as you like (within reason), and you can pull the information in either case in a number of ways. Craig rightly mentioned delimiters, but aside from that, you have chunks, offsets, lines, etc. or you can create your own function to store it, sort it, and pull it.