Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] [Javascript] Shouldn't there be a sort option on objects
- Date: Mon, 07 Feb 2011 17:55:04 +0900
- From: Raymond Wan <rwan.kyoto@example.com>
- Subject: Re: [tlug] [Javascript] Shouldn't there be a sort option on objects
- References: <4D4E75AB.5060703@example.com>
- User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101226 Icedove/3.0.11
Hi Dave, On 06/02/11 19:19, Dave M G wrote:Just spent the last hour or so going mental trying to apply a sort() on an object. Turns out it only works on arrays. Okay, fine, but then it turns out, as far as I can tell by looking around the net, that there is no sort() on objects, which seems to me a bit of a miss. I thought objects were supposed to be more dynamic and flexible.As I know nothing about Javascript, I'm probably not going to be as much help as Stephen's replies. Ignore what I say if it's no help to you. :-)For what it's worth, you can sort arbitrary objects that are in an array in C/C++ (i.e., array of objects). In C, you give it a sort function that tells it what the object looks like. i.e.,http://www.cplusplus.com/reference/clibrary/cstdlib/qsort/Of course, these objects need to be placed in an array in some initial linear order. If it was in some kind of associative array, then you would need to pull them out and throw them in an array for qsort () to work.Perhaps languages like Perl and Python can do something like this -- I've never tried. Examples of sorting objects in C/C++ are somewhat rare; most examples stick with easy cases...Ray
- Follow-Ups:
- Re: [tlug] [Javascript] Shouldn't there be a sort option on objects
- From: Josh Glover
- References:
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] Great Git resources -- thanks!
- Next by Date: Re: [tlug] [Javascript] Shouldn't there be a sort option on objects
- Previous by thread: Re: [tlug] [Javascript] Shouldn't there be a sort option on objects
- Next by thread: Re: [tlug] [Javascript] Shouldn't there be a sort option on objects
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links