{"action":"created","issue":{"url":"https://api.github.com/repos/nodejs/node/issues/5569","repository_url":"https://api.github.com/repos/nodejs/node","labels_url":"https://api.github.com/repos/nodejs/node/issues/5569/labels{/name}","comments_url":"https://api.github.com/repos/nodejs/node/issues/5569/comments","events_url":"https://api.github.com/repos/nodejs/node/issues/5569/events","html_url":"https://github.com/nodejs/node/issues/5569","id":138560035,"number":5569,"title":"Generators do not follow Iterator Spec","user":{"login":"ccorcos","id":1794527,"avatar_url":"https://avatars.githubusercontent.com/u/1794527?v=3","gravatar_id":"","url":"https://api.github.com/users/ccorcos","html_url":"https://github.com/ccorcos","followers_url":"https://api.github.com/users/ccorcos/followers","following_url":"https://api.github.com/users/ccorcos/following{/other_user}","gists_url":"https://api.github.com/users/ccorcos/gists{/gist_id}","starred_url":"https://api.github.com/users/ccorcos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ccorcos/subscriptions","organizations_url":"https://api.github.com/users/ccorcos/orgs","repos_url":"https://api.github.com/users/ccorcos/repos","events_url":"https://api.github.com/users/ccorcos/events{/privacy}","received_events_url":"https://api.github.com/users/ccorcos/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-04T19:13:32Z","updated_at":"2016-03-04T19:38:18Z","closed_at":null,"body":"```js\r\n> function* counter() { var i = 0; while(true) { yield i++ } }\r\nundefined\r\n> counter.next\r\nundefined\r\n> counter[Symbol.iterator]\r\nundefined\r\n```\r\n\r\nCheck out the \"Is a generator object an iterator or an iterable?\" section [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols)."},"comment":{"url":"https://api.github.com/repos/nodejs/node/issues/comments/192432248","html_url":"https://github.com/nodejs/node/issues/5569#issuecomment-192432248","issue_url":"https://api.github.com/repos/nodejs/node/issues/5569","id":192432248,"user":{"login":"bnoordhuis","id":275871,"avatar_url":"https://avatars.githubusercontent.com/u/275871?v=3","gravatar_id":"","url":"https://api.github.com/users/bnoordhuis","html_url":"https://github.com/bnoordhuis","followers_url":"https://api.github.com/users/bnoordhuis/followers","following_url":"https://api.github.com/users/bnoordhuis/following{/other_user}","gists_url":"https://api.github.com/users/bnoordhuis/gists{/gist_id}","starred_url":"https://api.github.com/users/bnoordhuis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bnoordhuis/subscriptions","organizations_url":"https://api.github.com/users/bnoordhuis/orgs","repos_url":"https://api.github.com/users/bnoordhuis/repos","events_url":"https://api.github.com/users/bnoordhuis/events{/privacy}","received_events_url":"https://api.github.com/users/bnoordhuis/received_events","type":"User","site_admin":false},"created_at":"2016-03-04T19:38:18Z","updated_at":"2016-03-04T19:38:18Z","body":"In your example, `counter` is not a generator object, it's a GeneratorFunction.  Try this instead:\r\n```\r\n> function* g() {}\r\nundefined\r\n\r\n> g().next\r\n[Function: next]\r\n\r\n> g()[Symbol.iterator]\r\n[Function: [Symbol.iterator]]\r\n```\r\nNote the difference:\r\n```\r\n> g.constructor\r\n[Function: GeneratorFunction]\r\n\r\n> g().constructor\r\nGeneratorFunction {}\r\n```"}}