{"action":"opened","issue":{"url":"https://api.github.com/repos/Jomsou/demo-blog/issues/18","repository_url":"https://api.github.com/repos/Jomsou/demo-blog","labels_url":"https://api.github.com/repos/Jomsou/demo-blog/issues/18/labels{/name}","comments_url":"https://api.github.com/repos/Jomsou/demo-blog/issues/18/comments","events_url":"https://api.github.com/repos/Jomsou/demo-blog/issues/18/events","html_url":"https://github.com/Jomsou/demo-blog/issues/18","id":313741243,"number":18,"title":"关于var、let、const的故事","user":{"login":"Jomsou","id":29729724,"avatar_url":"https://avatars3.githubusercontent.com/u/29729724?v=4","gravatar_id":"","url":"https://api.github.com/users/Jomsou","html_url":"https://github.com/Jomsou","followers_url":"https://api.github.com/users/Jomsou/followers","following_url":"https://api.github.com/users/Jomsou/following{/other_user}","gists_url":"https://api.github.com/users/Jomsou/gists{/gist_id}","starred_url":"https://api.github.com/users/Jomsou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jomsou/subscriptions","organizations_url":"https://api.github.com/users/Jomsou/orgs","repos_url":"https://api.github.com/users/Jomsou/repos","events_url":"https://api.github.com/users/Jomsou/events{/privacy}","received_events_url":"https://api.github.com/users/Jomsou/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-12T14:02:43Z","updated_at":"2018-04-12T14:02:43Z","closed_at":null,"author_association":"OWNER","body":"变量\r\nvar&&let&&const\r\n三者区别：\r\nlet：\r\n1.有块级作用域\r\n一般在for循环中使用\r\n经典案例：\r\nES6以前\r\n\r\nfor(var i=0;i<4;i++){\r\n    setTimeout(function(){\r\n         console.log(i);\r\n   },30)\r\n} //4 4 4 4\r\n当然了，这种情况也是有解决的办法的。\r\n\r\n for (var i=1; i<=4; i++) {\r\n     (function(j){\r\n         setTimeout( function timer(){\r\n             console.log( j );\r\n         }, 1000 );\r\n     })( i );\r\n }\r\n2.不存在变量提升\r\n\r\n3.不允许重复声明\r\n4.暂时性死区"}}
{"actor":{"display_login":"Jomsou"}}