Skip to content

Instantly share code, notes, and snippets.

@getify
Created April 7, 2014 19:19
Show Gist options
  • Save getify/10034276 to your computer and use it in GitHub Desktop.
Save getify/10034276 to your computer and use it in GitHub Desktop.
bug with for-of iteration of traceur/es6fiddle?
var obj = {
_step: 0
};
obj[Symbol.iterator] = function() {
return {
next: function() {
return { value: ++obj._step, done: (obj._step === 4) };
}
};
};
for (var v of obj){
console.log(v);
}
// Expect:
// 1
// 2
// 3
// 4
// Get (via traceur and es6fiddle):
// 1
// 2
// 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment