I have turned on the Chrome flag for experimental ECMAscript 6 features, one of which is Set
. As I understand, the details of Set
are broadly agreed upon by the spec writers.
I create a set a
and add the string 'Hello'
a = Set();
a.add('Hello');
but how do I iterate over the elements of a
?
for(let i of a) { console.log(i); }
gives "SyntaxError: Illegal let
declaration outside extended mode"
for(var i of a) { console.log(i); }
gives "SyntaxError: Unexpected identifier"
for(var i in a) { console.log(i); }
gives Undefined
Is it possible to iterate over of a set in Chrome 26?