On Thu, Mar 17, 2011 at 3:01 AM, RobG <[email protected]> wrote: > > > On Mar 17, 10:47 am, RobG <[email protected]> wrote: >> On Mar 17, 10:40 am, RobG <[email protected]> wrote: >> [...] >> >> > Try this in various browsers: >> >> > (function() { >> [...] >> > })(); >> >> Here's one I forgot to add: >> >> // How about an array object >> var arr = []; >> arr[1] = 'one'; >> arr[0] = 'two'; >> show('Is an array in order?\n', arr); >> >> As expected, some return the properties in index order, others in the >> order they are added. So *please* do not encourage anyone to think >> properties will be returned in the order they are added because they >> aren't, nor are they required to be, even in the latest ECMAScript >> edition. > > And another: > > // Add some properties in order > obj['0'] = 0; > obj.first = 'first'; > obj.second = 'second'; > obj.third = 'third'; > obj.fourth = 'fourth'; > obj['5'] = 5; > > Chrome 10 and Opera 11 return them in the following order: > > 0,5,first,second,third,fourth >
Do they get performances benefits on the lookups by reordering members this way ? -- Diego > > -- > Rob > > -- > To view archived discussions from the original JSMentors Mailman list: > http://www.mail-archive.com/[email protected]/ > > To search via a non-Google archive, visit here: > http://www.mail-archive.com/[email protected]/ > > To unsubscribe from this group, send email to > [email protected] > -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
