Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tlug] [Javascript] Shouldn't there be a sort option on objects



No.  In all languages where I know anything about objects, they have
named attributes which are in principle unordered (typically
implemented as a hash table or association list).  If you want an
object with ordered attributes, give it an attribute which contains an
array of the data you want to sort.

 > For more specifics, my object looks like this
 > 
 > toplevel.midlevel.dataIWantToSortBy
 > 
 > "midlevel" is just a number that I use to order the data when I display
 > it.

Why does toplevel need to be an object?  Why not make it an array
directly?  That is even if toplevel *is* an object, why not do the
sorting in an auxiliary array?



Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links