Entry
theData["uniqueidhere"]=new record(..) works, it stores it, but theData.length returns 0, why?
Jun 12th, 2002 14:53
David Blackledge, Gareth Hay,
When you use the syntax object[string], you're not actually using an
Array subscript, you're using an object property reference.
Specifically
theData["myid"]
is exactly equivalent to
theData.myid
The first syntax is useful when you have a string variable, or if you
have a property that has special characters in the name like a dash
(minus).
So, even if you're using an array, doing
theData["uniqueidhere"]=new record(..)
just assigns the new record to a new property of the object named the
same as the unique id. You could just as easily write
theData.uniqueidhere = new record(..).
The Array object will only update the length if you use an integer
index.
David.
http://David.Blackledge.com