{"action":"created","issue":{"url":"https://api.github.com/repos/zliuwd/learningnote/issues/87","repository_url":"https://api.github.com/repos/zliuwd/learningnote","labels_url":"https://api.github.com/repos/zliuwd/learningnote/issues/87/labels{/name}","comments_url":"https://api.github.com/repos/zliuwd/learningnote/issues/87/comments","events_url":"https://api.github.com/repos/zliuwd/learningnote/issues/87/events","html_url":"https://github.com/zliuwd/learningnote/issues/87","id":250768344,"node_id":"MDU6SXNzdWUyNTA3NjgzNDQ=","number":87,"title":"var,let 和const 的用法","user":{"login":"zliuwd","id":25130704,"node_id":"MDQ6VXNlcjI1MTMwNzA0","avatar_url":"https://avatars0.githubusercontent.com/u/25130704?v=4","gravatar_id":"","url":"https://api.github.com/users/zliuwd","html_url":"https://github.com/zliuwd","followers_url":"https://api.github.com/users/zliuwd/followers","following_url":"https://api.github.com/users/zliuwd/following{/other_user}","gists_url":"https://api.github.com/users/zliuwd/gists{/gist_id}","starred_url":"https://api.github.com/users/zliuwd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zliuwd/subscriptions","organizations_url":"https://api.github.com/users/zliuwd/orgs","repos_url":"https://api.github.com/users/zliuwd/repos","events_url":"https://api.github.com/users/zliuwd/events{/privacy}","received_events_url":"https://api.github.com/users/zliuwd/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-08-16T21:39:33Z","updated_at":"2018-07-01T17:12:01Z","closed_at":null,"author_association":"OWNER","body":"```\r\n\"use strict\";\r\n// error:Block-scoped declarations (let, const, function, class) not yet supported outside strict mode，一些ES6里声明的方法必须在严格模式上才能使用，不然会报此错误\r\n\r\nconst a=1;\r\n// const a=2;\r\n// error:Identifier 'a' has already been declared\r\n// a=2;\r\n// error:Assignment to constant variable.\r\n// 【const是常数变量，即一般在require一个模块的时候用或者定义一些全局常量，一旦定义，无法更改，无法重复赋值】\r\ndocument.write('a: '+a+'<br />');\r\n\r\nlet b=1;\r\n// let a=2; \r\n// error:Identifier 'a' has already been declared\r\n// 【let 变量，块作用域，不能重复声明覆盖，限制了变量的作用域，保证变量不会去污染全局变量，所以尽量将var改为用let。】\r\nb=2;\r\ndocument.write('b: '+b+'<br />');\r\n\r\nvar c=1;\r\nvar c=2;\r\nc=3;\r\ndocument.write('c: '+c);\r\n```"},"comment":{"url":"https://api.github.com/repos/zliuwd/learningnote/issues/comments/401619877","html_url":"https://github.com/zliuwd/learningnote/issues/87#issuecomment-401619877","issue_url":"https://api.github.com/repos/zliuwd/learningnote/issues/87","id":401619877,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMTYxOTg3Nw==","user":{"login":"zliuwd","id":25130704,"node_id":"MDQ6VXNlcjI1MTMwNzA0","avatar_url":"https://avatars0.githubusercontent.com/u/25130704?v=4","gravatar_id":"","url":"https://api.github.com/users/zliuwd","html_url":"https://github.com/zliuwd","followers_url":"https://api.github.com/users/zliuwd/followers","following_url":"https://api.github.com/users/zliuwd/following{/other_user}","gists_url":"https://api.github.com/users/zliuwd/gists{/gist_id}","starred_url":"https://api.github.com/users/zliuwd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zliuwd/subscriptions","organizations_url":"https://api.github.com/users/zliuwd/orgs","repos_url":"https://api.github.com/users/zliuwd/repos","events_url":"https://api.github.com/users/zliuwd/events{/privacy}","received_events_url":"https://api.github.com/users/zliuwd/received_events","type":"User","site_admin":false},"created_at":"2018-07-01T17:12:00Z","updated_at":"2018-07-01T17:12:00Z","author_association":"OWNER","body":"# Const\r\n* const 不允许 reassign ，不允许从新指派，例如你说 const a=100 ， 那a就不能再赋值了\r\n* 但是const obj={key:value} 这个value是可以改的"}}
{"actor":{"display_login":"zliuwd"}}