Hacker News new | past | comments | ask | show | jobs | submit login

I checked the spec again:

It's unclear: At one point it says "An object is an unordered set of name/value pairs." while in the actual grammar it is ordered:

    object
        '{' ws '}'
        '{' members '}'
    
    members
        member
        member ',' members



I recommend reading the ECMA-404 spec instead. It's less ambiguous, and basically says that you can treat the pairs as ordered if you want, as the syntax itself doesn't imbue the order with any meaning:

https://www.ecma-international.org/wp-content/uploads/ECMA-4...


Grammar is inherently ordered, semantics is different from syntax.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: