Dmitry Soshnikov wrote:
```js
let [x,y] = set; // x='a'; y='b’;
```
Would this work actually? :) Destructuring does get property, which
wouldn't call set's `get` method.
See
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
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
+1
---
R. Mark Volkmann
Object Computing, Inc.
On Jan 18, 2015, at 6:28 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 =
4 matches
Mail list logo