On Sun Jan 18 2015 at 7:28:15 AM Axel Rauschmayer <a...@rauschma.de> wrote:
> Currently the keys of the entries returned by `Set.prototype.entries()` > are the same as the values: > > ```js > let set = new Set(['a', 'b']); > > let pairs = [...set.entries()]; > console.log(JSON.stringify(pairs)); // [["a","a"],["b","b”]] > ``` > > Given that sets are ordered, I’d use the “position” of an entry as the > key: [[0,"a"],[1,"b”]] > Sets are not a linear data structure, so the order of entries in a Set is irrelevant, unlike an Array whose elements must have an explicit position. Set entries in JS have an iteration order purely to match programmer intuition (and ensure that all implementations adhere), however there is no structural importance of the order. Rick
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss