Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6022259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:49:58+00:00 2026-05-23T03:49:58+00:00

This question is vital to one of my current projects involving creating HTML tables

  • 0

This question is vital to one of my current projects involving creating HTML tables from JSON objects. I was thinking I could create functions that would sort my Arrays/Objects before rendering them as HTML. My only concern is that order doesn’t matter in JavaScript, and if I were to create a new Array with the same data (in a different order) as another Array they would end up identical.

I can’t think of a fast way to test this, so I’m asking here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T03:49:59+00:00Added an answer on May 23, 2026 at 3:49 am

    Others have answered on arrays, so I just wanted to provide some info on objects.

    On that, the standard is non-existent, but it’s de facto definition is that an object will enumerate in insertion order, with the exception that numbers are placed in ascending order and enumerated first. I say typically, but this behavior is nowhere near standardized (nor do frameworks like jQuery standardize it, AFAIK).

    You can test browsers using this jsFiddle:

    http://jsfiddle.net/7cCpu/4/

    The object {"foo":"bar", "bar":"foo", "baz":"baz", "3":3, "2":2, "1":1} enumerates as follows:

    foo, bar, baz, 3, 2, 1 // insertion order
    
    1, 2, 3, foo, bar, baz // Chrome enumeration
    1, 2, 3, foo, bar, baz // Opera
    1, 2, 3, foo, bar, baz // IE9
    foo, bar, baz, 3, 2, 1 // Firefox (!!!)
    

    I don’t have Safari installed, but I assume it’s the same as Chrome. In any case, the point is that you can make assumptions — it’s not random — but it’s probably a better idea to use an array if you depend on exact enumeration.

    Even nastier is what duri pointed out above, where deleting and replacing the value for a key alters things further. Watch what happens when I delete bar and do Object.bar = "foo" then enumerate:

    1, 2, 3, foo, baz, bar // Chrome enumeration
    1, 2, 3, foo, baz, bar // Opera
    1, 2, 3, foo, bar, baz // IE9 (!!!)
    foo, baz, 3, 2, 1, bar // Firefox (!!!)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question is similar in concept to this one , except I see I
This question is related to another question I wrote: Trouble using DOTNET from PHP.
This question came up from what I see on a clients side: Intermittent Connection
This question is related to the one I asked here . I'm trying to
Similar question from last night, I don't have access to edit the source HTML
(This question is a follow up from Safari Scrollbars & SVG - the workaround
Obviously, this question is a bit Rails beginner question, however it is vital for
This Question relates to Mule ESB 3.2. If I have read values from JMS,
This question is related to this one : If I have a heap dump
I have one more question(first one is here: html, css with center div problem

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.