I would like to iterate through the key of an unordered dictionary in Javascript. I don't even know if it does exist or not.
At the moment I am having the following code :
var l = [5,3,2];
var unorderedDict = {};
for (var i=0; i<l.length; i++) {
unorderedDict[l[i]] = 'foo';
}
My dictionary will then be like : {2:'foo', 3:'foo', 5:'foo'}
or in my case, I would like to keep the ordering of the initial list (so : {5:'foo', 3:'foo', 2:'foo'}
)
How can I achieve this ?