Björn Söderqvist wrote:
I have an object whose properties are not alphabetically sorted, like so:
{a:1, c:3, b:2}
I would now like to have a function which can return a similar object,
only with the properties sorted alphabetically:
{a:1, b:2,c:3}
I'm stuck right now as I can't figure out how to do this correctly. Is
it necessary to go via an array, throw in a custom sorting method,
then throw the properties back into an object?
The properties of an object are not ordered. And a for..in loop does not
define any order in which properties are returned.
--
Martin Honnen --- MVP Data Platform Development
http://msmvps.com/blogs/martin_honnen/
--
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]