{"action":"closed","issue":{"url":"https://api.github.com/repos/alsotang/node-lessons/issues/79","labels_url":"https://api.github.com/repos/alsotang/node-lessons/issues/79/labels{/name}","comments_url":"https://api.github.com/repos/alsotang/node-lessons/issues/79/comments","events_url":"https://api.github.com/repos/alsotang/node-lessons/issues/79/events","html_url":"https://github.com/alsotang/node-lessons/issues/79","id":125977349,"number":79,"title":"闭包的一个坑,结果不是12345","user":{"login":"yinzSE","id":12208108,"avatar_url":"https://avatars.githubusercontent.com/u/12208108?v=3","gravatar_id":"","url":"https://api.github.com/users/yinzSE","html_url":"https://github.com/yinzSE","followers_url":"https://api.github.com/users/yinzSE/followers","following_url":"https://api.github.com/users/yinzSE/following{/other_user}","gists_url":"https://api.github.com/users/yinzSE/gists{/gist_id}","starred_url":"https://api.github.com/users/yinzSE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yinzSE/subscriptions","organizations_url":"https://api.github.com/users/yinzSE/orgs","repos_url":"https://api.github.com/users/yinzSE/repos","events_url":"https://api.github.com/users/yinzSE/events{/privacy}","received_events_url":"https://api.github.com/users/yinzSE/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2016-01-11T16:08:27Z","updated_at":"2016-01-13T17:10:29Z","closed_at":"2016-01-13T17:10:29Z","body":">闭包的一个坑\r\n==========\r\n```\r\nfor (var i = 0; i < 5; i++) {\r\n  setTimeout(function () {\r\n    console.log(i);\r\n  }, 5);\r\n}\r\n```\r\n上面这个代码块会打印五个 5 出来，而我们预想的结果是打印 1 2 3 4 5。\r\n\r\n应该是 `0 1 2 3 4`"}}