{"id":2798,"date":"2018-06-20T09:00:34","date_gmt":"2018-06-20T00:00:34","guid":{"rendered":"https:\/\/alaki.co.jp\/blog\/?p=2798"},"modified":"2022-12-03T09:00:06","modified_gmt":"2022-12-03T00:00:06","slug":"javascript%e3%81%ae%e3%82%b9%e3%82%b3%e3%83%bc%e3%83%97%e3%81%a8%e5%86%8d%e5%ae%a3%e8%a8%80%e3%82%92%e5%be%a9%e7%bf%92%e3%81%97%e3%82%88%e3%81%86%ef%bc%81","status":"publish","type":"post","link":"http:\/\/test.alaki.co.jp\/blog\/?p=2798","title":{"rendered":"JavaScript\u306e\u30b9\u30b3\u30fc\u30d7\u3068\u518d\u5ba3\u8a00\u3092\u5fa9\u7fd2\u3057\u3088\u3046\uff01"},"content":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\u3001Web\u30d7\u30ed\u30b0\u30e9\u30de\u306e\u7be0\u7530\u3067\u3059\u3002<\/p>\n<p>\u5148\u65e5\u3001\u793e\u5185\u3067JavaScript\u306e\u52c9\u5f37\u4f1a\u3092\u884c\u3044\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u306e\u4e2d\u3067\u3001\u793e\u5185\u3067\u306eJavaScript\u306e\u30eb\u30fc\u30eb\u3092\u7528\u610f\u3057\u3088\u3046\u3068\u3044\u3046\u3053\u3068\u306b\u306a\u308a\u3001\u30d9\u30fc\u30b9\u3068\u306a\u308b\u57fa\u6e96\u3092\u300cES2015\uff08ES6\uff09\u300d\u3067\u4f5c\u3063\u3066\u3044\u3053\u3046\u304b\u3068\u8003\u3048\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u306e\u4e2d\u3067\u3001\u4eca\u56de\u306fJavaScript\u306e\u5909\u6570\u306e\u30b9\u30b3\u30fc\u30d7\u3068\u518d\u5ba3\u8a00\u306b\u95a2\u3057\u3066\u3001\u5fa9\u7fd2\u3092\u517c\u306d\u3066\u307e\u3068\u3081\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p><!--more--><\/p>\n<h2>\u300cES2015\uff08ES6\uff09\u300d\u3068\u306f\uff1f<\/h2>\n<p>ECMAScript\uff08\u30a8\u30af\u30de\u30b9\u30af\u30ea\u30d7\u30c8\uff09\u3068\u3044\u3046JavaScript\u306e\u6a19\u6e96\u898f\u683c\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u300cES2015\u300d\u3068\u3044\u3046\u306e\u306f\u3001ECMAScript\u306e\u30d0\u30fc\u30b8\u30e7\u30f36\uff086th Edition\uff09\u304c\u6a19\u6e96\u5316\u3055\u308c\u305f\u540d\u79f0\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u30a8\u30f3\u30b8\u30cb\u30a2\u306e\u4e2d\u3067\u306f\u3001\u300cECMAScript 6th Edition\u300d\u306e\u65b9\u304c\u6d78\u900f\u3057\u3066\u3044\u308b\u305f\u3081\u300cES6\u300d\u3068\u8868\u8a18\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u591a\u3044\u3067\u3059\u3002<\/p>\n<p>\u300cES2015\uff08ES6\uff09\u300d\u306f\u3001\u65b0\u3057\u3044\u6a5f\u80fd\u3084\u69cb\u6587\u304c\u8ffd\u52a0\u3055\u308c\u3066\u304a\u308a\u3001\u6614\u304b\u3089\u306eJavaScript\u306e\u5e38\u8b58\u3068\u7570\u306a\u3063\u3066\u3044\u308b\u90e8\u5206\u3082\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u5909\u6570\u306e\u53d6\u308a\u6271\u3044\u306b\u95a2\u3057\u3066\u3001\u300cES2015\uff08ES6\uff09\u300d\u3067\u306f\u30b9\u30b3\u30fc\u30d7\u3092\u610f\u8b58\u3057\u305f\u66f8\u5f0f\u3092\u6c42\u3081\u3089\u308c\u307e\u3059\u3002<\/p>\n<h2>\u30b9\u30b3\u30fc\u30d7\u3092\u610f\u8b58\u3057\u3066\u300clet\u300d\u306b\u5207\u308a\u66ff\u3048\u308b<\/h2>\n<p>JavaScript\u306e\u5909\u6570\u5ba3\u8a00\u3068\u3044\u3048\u3070\u300cvar\u300d\u3092\u4f7f\u3046\u306e\u304c\u304a\u6c7a\u307e\u308a\u3067\u3057\u305f\u3002<\/p>\n<p>\u3067\u3059\u304c\u3001\u300cvar\u300d\u3092\u4f7f\u3063\u305f\u5909\u6570\u306b\u306f\u3001\u300cvar\u300d\u3067\u5b9a\u7fa9\u3055\u308c\u305f\u5909\u6570\u3092\u542b\u3080\u95a2\u6570\u5168\u4f53\u3067\u5229\u7528\u53ef\u80fd\u3068\u306a\u308a\u3001\u53b3\u5bc6\u306a\u30b9\u30b3\u30fc\u30d7\u306e\u5236\u7d04\u3092\u3046\u3051\u307e\u305b\u3093\u3067\u3057\u305f\u3002<\/p>\n<p>\u3053\u308c\u306f\u3001\u878d\u901a\u304c\u52b9\u304f\u3068\u3044\u3046\u6349\u3048\u65b9\u3082\u3067\u304d\u307e\u3059\u304c\u3001\u6f5c\u5728\u7684\u306a\u30d0\u30b0\u3092\u5185\u5305\u3059\u308b\u3068\u3044\u3046\u5371\u967a\u6027\u3082\u542b\u307e\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u300cES2015\uff08ES6\uff09\u300d\u3067\u306f\u3001\u3088\u308a\u53b3\u5bc6\u306a\u30b9\u30b3\u30fc\u30d7\u3092\u610f\u8b58\u3055\u305b\u305f\u69cb\u9020\u3092\u6c42\u3081\u3089\u308c\u307e\u3059\u3002<\/p>\n<p>\u305d\u3053\u3067\u3001\u53b3\u5bc6\u306a\u30b9\u30b3\u30fc\u30d7\u306e\u5236\u7d04\u3092\u5909\u6570\u306b\u8a2d\u3051\u308b\u306e\u306b\u5229\u7528\u3059\u308b\u306e\u304c\u300clet\u300d\u3067\u3059\u3002<\/p>\n<p>\u300clet\u300d\u3067\u5b9a\u7fa9\u3055\u308c\u305f\u5909\u6570\u306f\u3001\u5b9a\u7fa9\u3055\u308c\u305f\u300c\u30d6\u30ed\u30c3\u30af\u300d\u5185\u3067\u306e\u307f\u6709\u52b9\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>\u300cvar\u300d\u3092\u4f7f\u3063\u305f\u30b9\u30b3\u30fc\u30d7\u306e\u4f8b<\/h3>\n<p>\u300cvar\u300d\u3092\u4f7f\u3063\u305f\u30b9\u30b3\u30fc\u30d7\u4f8b\u3067\u3059\u3002<\/p>\n<pre class=\"lang:js decode:true \">    varTest();\r\n\r\n    function varTest() {\r\n        var x = 21;\r\n        if (true) {\r\n            var x = 41;  \/\/ \u540c\u3058\u5909\u6570\r\n            console.log(x);  \/\/ 41\r\n        }\r\n        console.log(x);  \/\/ 41\r\n    }<\/pre>\n<p>\u300cvar\u300d\u3067\u5b9a\u7fa9\u3055\u308c\u305f\u300cx\u300d\u306e\u5024\u304c\u6761\u4ef6\u5206\u5c90\u306e\u30d6\u30ed\u30c3\u30af\u3092\u629c\u3051\u3066\u3082\u3001\u5024\u304c\u7dad\u6301\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002<\/p>\n<h3>\u300clet\u300d\u3092\u4f7f\u3063\u305f\u30b9\u30b3\u30fc\u30d7\u306e\u4f8b<\/h3>\n<p>\u300clet\u300d\u3092\u4f7f\u3063\u305f\u30b9\u30b3\u30fc\u30d7\u4f8b\u3067\u3059\u3002<\/p>\n<pre class=\"lang:js decode:true \">    letTest();\r\n\r\n    function letTest() {\r\n        let x = 21;\r\n        if (true) {\r\n            let x = 41;  \/\/ \u540c\u3058\u5909\u6570\r\n            console.log(x);  \/\/ 41\r\n        }\r\n        console.log(x);  \/\/ 21\r\n    }<\/pre>\n<p>\u300cvar\u300d\u3068\u306f\u7570\u306a\u308a\u3001\u30d6\u30ed\u30c3\u30af\u5185\u3068\u30d6\u30ed\u30c3\u30af\u5916\u3067\u300cx\u300d\u306e\u5024\u304c\u7570\u306a\u308a\u307e\u3059\u3002<br \/>\n\u3053\u308c\u306f\u3001\u30d6\u30ed\u30c3\u30af\u5185\u3067\u5b9a\u7fa9\u3055\u308c\u305f\u5909\u6570\u306e\u6709\u52b9\u7bc4\u56f2\u304c\u3001\u30d6\u30ed\u30c3\u30af\u5185\u3067\u53ce\u307e\u3063\u3066\u3044\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u3088\u3046\u306b\u3001\u300clet\u300d\u3092\u4f7f\u3046\u3053\u3068\u3067\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u52d5\u304d\u3092\u30b9\u30b3\u30fc\u30d7\u3092\u3082\u3068\u306b\u610f\u56f3\u3057\u305f\u52d5\u304d\u3092\u5236\u5fa1\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2>\u518d\u5ba3\u8a00\u4e88\u9632\u3068\u3057\u3066\u306e\u300clet\u300d<\/h2>\n<p>\u300clet\u300d\u306e\u3082\u30461\u3064\u306e\u52b9\u679c\u3068\u3057\u3066\u300c\u518d\u5ba3\u8a00\u4e88\u9632\u300d\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<h3>\u300cvar\u300d\u3092\u4f7f\u3063\u305f\u518d\u5ba3\u8a00\u306e\u4f8b<\/h3>\n<pre class=\"lang:js decode:true \">var x = 2;\r\nvar x = 4;\r\nconsole.log(x);<\/pre>\n<p>\u3053\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u306f\u3001\u6b63\u3057\u304f\u52d5\u304d\u300c4\u300d\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<br \/>\n\u305f\u3060\u3057\u3001\u300cx\u300d\u304c\u8907\u6570\u56de\u5ba3\u8a00\u3055\u308c\u3066\u3044\u308b\u3068\u3044\u3046\u53b3\u5bc6\u306a\u8a00\u8a9e\u3092\u6271\u3063\u3066\u304d\u305f\u65b9\u306b\u3068\u3063\u3066\u306f\u6c17\u6301\u3061\u60aa\u3044\u66f8\u304d\u65b9\u3060\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h3>\u300clet\u300d\u3092\u4f7f\u3063\u305f\u518d\u5ba3\u8a00\u306e\u4f8b<\/h3>\n<pre class=\"lang:js decode:true \">let x = 2;\r\nlet x = 4;\r\nconsole.log(x);<\/pre>\n<p>\u3053\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306a\u30a8\u30e9\u30fc\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true \">Uncaught SyntaxError: Identifier 'x' has already been declared<\/pre>\n<p>\u3053\u306e\u30a8\u30e9\u30fc\u306f\u3001\u5909\u6570\u300cx\u300d\u306f\u3059\u3067\u306b\u5ba3\u8a00\u3055\u308c\u3066\u3044\u308b\u3068\u3044\u3046\u30a8\u30e9\u30fc\u3067\u3059\u3002<\/p>\n<p>\u3053\u306e\u3053\u3068\u304b\u3089\u3001\u300clet\u300d\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3067\u518d\u5ba3\u8a00\u3092\u884c\u3048\u306a\u304f\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u3001<br \/>\n\u4e0d\u7528\u610f\u306a\u4e0a\u66f8\u304d\u3092\u907f\u3051\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2>\u307e\u3068\u3081<\/h2>\n<p>\u3053\u308c\u307e\u3067\u306b\u4f5c\u6210\u3057\u3066\u304d\u305f\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u6025\u306b\u300cvar\u300d\u304b\u3089\u300clet\u300d\u306b\u66f8\u304d\u63db\u3048\u308b\u3068<br \/>\n\u601d\u308f\u306c\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3059\u308b\u3088\u3046\u306b\u306a\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u308c\u306f\u3001\u30b9\u30b3\u30fc\u30d7\u3084\u518d\u5ba3\u8a00\u3068\u3044\u3063\u305f\u3053\u3068\u3092\u610f\u8b58\u305b\u305a\u306b\u4f5c\u3063\u3066\u304d\u305f\u8a3c\u660e\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>\u300clet\u300d\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u300cvar\u300d\u3088\u308a\u5f37\u56fa\u306a\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u66f8\u304f\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u305c\u3072\u3001\u65b0\u3057\u3044JavaScript\u306e\u66f8\u304d\u65b9\u3092\u8a66\u3057\u3066\u3001\u3088\u308a\u30d0\u30b0\u306e\u5c11\u306a\u3044\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u66f8\u3044\u3066\u3044\u304d\u307e\u3057\u3087\u3046\uff01<\/p>\n<p>&nbsp;<\/p>\n<hr \/>\n<h3>\u73fe\u5834\u306e\u696d\u52d9\u30d5\u30ed\u30fc\u306b\u5bc4\u308a\u6dfb\u3063\u305fWeb\u30b7\u30b9\u30c6\u30e0\u3092\u304a\u6c42\u3081\u306a\u3089\u3001\u79c1\u305f\u3061ALAKI\u306b\u3054\u76f8\u8ac7\u304f\u3060\u3055\u3044\u3002<\/h3>\n<p>ALAKI\u306f\u7d4c\u55b6\u8005\u69d8\u304c\u611f\u3058\u3066\u3044\u308b\u554f\u984c\u70b9\u3068\u3001\u5b9f\u969b\u306bWeb\u30b7\u30b9\u30c6\u30e0\u3092\u5229\u7528\u3055\u308c\u308b\u73fe\u5834\u30b9\u30bf\u30c3\u30d5\u69d8\u304c\u76f4\u9762\u3057\u3066\u3044\u308b\u8ab2\u984c\u3092\u3001\u5f0a\u793e\u30b7\u30b9\u30c6\u30e0\u30a8\u30f3\u30b8\u30cb\u30a2\u304c\u4e01\u5be7\u306b\u805e\u304d\u53d6\u308a\u3001\u304a\u5ba2\u69d8\u3068\u5171\u306b\u30b7\u30b9\u30c6\u30e0\u3092\u4f5c\u308a\u4e0a\u3052\u3066\u3044\u304d\u307e\u3059\u3002<br \/>\n\u696d\u52d9\u6539\u5584\u304c\u5b9f\u73fe\u3067\u304d\u308bWeb\u30b7\u30b9\u30c6\u30e0\u3092\u304a\u6c42\u3081\u306e\u65b9\u306f\u3001\u662f\u975eALAKI\u306b\u3054\u76f8\u8ac7\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><a href=\"https:\/\/alaki.co.jp\/websystem\/\">\u30fbALAKI\u306eWeb\u30b7\u30b9\u30c6\u30e0\u958b\u767a<\/a><\/p>\n<p><a href=\"https:\/\/alaki.co.jp\/lp\/cloud-ordering-system\/\">\u30fbALAKI\u306e\u30af\u30e9\u30a6\u30c9\u578b\u53d7\u767a\u6ce8\u30b7\u30b9\u30c6\u30e0<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\u3001Web\u30d7\u30ed\u30b0\u30e9\u30de\u306e\u7be0\u7530\u3067\u3059\u3002 \u5148\u65e5\u3001\u793e\u5185\u3067JavaScr&#46;&#46;&#46;<\/p>\n","protected":false},"author":5,"featured_media":2801,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[45,16],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"http:\/\/test.alaki.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2798"}],"collection":[{"href":"http:\/\/test.alaki.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/test.alaki.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/test.alaki.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"http:\/\/test.alaki.co.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2798"}],"version-history":[{"count":7,"href":"http:\/\/test.alaki.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2798\/revisions"}],"predecessor-version":[{"id":4085,"href":"http:\/\/test.alaki.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2798\/revisions\/4085"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/test.alaki.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/media\/2801"}],"wp:attachment":[{"href":"http:\/\/test.alaki.co.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2798"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/test.alaki.co.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2798"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/test.alaki.co.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2798"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}