On 4 April 2012 19:16, avasilev <[email protected]> wrote:

> If we have this javascript code:
>  var obj =
> {
>  b:{propb: 10},
>  d: {propd: 15},
>  c: {propc: 15},
>  a: {propa: 5}
> }
>
> Does v8::Object::GetPropertyNames() guarantee that the property names
> will be returned in the same order as they were defined above? I did a
> test, and the order is preserved, but I want to know if this is
> guaranteed.
>

Short answer: no. The order in which property names are returned depends on
many volatile factors, and it would be quite expensive for the VM to
guarantee a particular ordering in all cases. It might work in some, but
better don't rely on it. Just like in JS itself, enumeration order should
best be considered undefined.

/Andreas

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to