{"id":1270,"date":"2017-01-04T10:57:24","date_gmt":"2017-01-04T01:57:24","guid":{"rendered":"http:\/\/www.chihayafuru.jp\/tech\/?p=1270"},"modified":"2017-02-13T14:21:02","modified_gmt":"2017-02-13T05:21:02","slug":"var-%e3%81%a8-let-%e3%81%ae%e9%81%95%e3%81%84","status":"publish","type":"post","link":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/archives\/1270","title":{"rendered":"var \u3068 let \u306e\u9055\u3044"},"content":{"rendered":"<h1>1. ECMAScript 2015 \/ ECMAScript 6 (ES6),  [TypeScript]<\/h1>\n<h2>1-1. var<\/h2>\n<p><b>\u95a2\u6570\u30b9\u30b3\u30fc\u30d7<\/b><br \/>\n\u53b3\u5bc6\u306b\u306f\u3001function, module, namespace, or global scope<\/p>\n<pre class=\"lang:js decode:true \" >function scope_sample_var() {\r\n    var i = 1;\r\n    console.log(i);         \/\/ =&gt; 1\r\n    {\r\n        var i = 2;\r\n        console.log(i);     \/\/ =&gt; 2\r\n    }\r\n    console.log(i);         \/\/ =&gt; 2\r\n}\r\n\r\nscope_sample_var();<\/pre>\n<p><!--more--><br \/>\n&nbsp;<\/p>\n<h2>1-2. let<\/h2>\n<p><b>\u30d6\u30ed\u30c3\u30af\u30b9\u30b3\u30fc\u30d7<\/b><br \/>\nlexical-scoping or block-scoping<\/p>\n<pre class=\"lang:js decode:true \" >function scope_sample_let() {\r\n    let i = 1;\r\n    console.log(i);         \/\/ =&gt; 1\r\n    {\r\n        let i = 2;\r\n        console.log(i);     \/\/ =&gt; 2\r\n    }\r\n    console.log(i);         \/\/ =&gt; 1\r\n}\r\n\r\nscope_sample_let();<\/pre>\n<p>&nbsp;<\/p>\n<h2>\u88dc\u8db3. const<\/h2>\n<p><b>\u5b9a\u6570<\/b><\/p>\n<pre class=\"lang:js decode:true \" >const i = 1;<\/pre>\n<p>&nbsp;<\/p>\n<h1>2. Swift<\/h1>\n<h2>2-1. var<\/h2>\n<p><b>\u5909\u6570<\/b><\/p>\n<pre class=\"lang:swift decode:true \" >var i = 0<\/pre>\n<p>&nbsp;<\/p>\n<h2>2-2. let<\/h2>\n<p><b>\u5b9a\u6570<\/b><\/p>\n<pre class=\"lang:swift decode:true \" >let i = 0<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>1. ECMAScript 2015 \/ ECMAScript 6 (ES6), [TypeScript] 1-1. var \u95a2\u6570\u30b9\u30b3\u30fc\u30d7 \u53b3\u5bc6\u306b\u306f\u3001function, module, namespace, or glo [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[40,22,27],"class_list":["post-1270","post","type-post","status-publish","format-standard","hentry","category-memo","tag-javascript","tag-swift","tag-typescript"],"_links":{"self":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/1270","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/comments?post=1270"}],"version-history":[{"count":10,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/1270\/revisions"}],"predecessor-version":[{"id":1281,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/1270\/revisions\/1281"}],"wp:attachment":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/media?parent=1270"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/categories?post=1270"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/tags?post=1270"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}