I will post this issue again as It seems that completelly disappeared
from Group...
Anyway I wanted to post my up to date research result on this....
---------------------------------------------------------------------------------------------------------
I'm struggling to find something very simple.
Question 1:
If I have an array of integers and I use a for-in construct, do I get
them in the same order they are present inside array?
ex:
var v = [1,2,3,4]
for(var i in v){
print(i + '-->' + v[i]);
}
is this similar to
for(var i=0;i<v.length; i++){
print(i + '-->' + v[i]);
}
>From what I know (and saw in ECMA 262) for-in returns the properties
of an object and does not guarantee the order of the properties....so
the answer seems to be "no" - those 2 constructs are not equivalent.
(from this point of view)
Question 2:
If you can use both first and second construct does it means that the
indices of the vector are both properties (of object Array) and
indices of the array?
--
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]