{"id":2096,"date":"2021-01-01T20:59:15","date_gmt":"2021-01-01T11:59:15","guid":{"rendered":"https:\/\/auto-worker.com\/blog\/?p=2096"},"modified":"2021-01-01T21:14:48","modified_gmt":"2021-01-01T12:14:48","slug":"post-2096","status":"publish","type":"post","link":"https:\/\/auto-worker.com\/blog\/?p=2096","title":{"rendered":"Google Apps Script(GAS)\u3067var,let,const\u306e\u5909\u6570\u5ba3\u8a00\u306e\u9055\u3044\u3068\u4f7f\u3044\u5206\u3051\u3092\u89e3\u8aac"},"content":{"rendered":"<p>Google Apps Script(GAS)\u306e\u30b3\u30fc\u30c9\u3067\u5909\u6570\u306e\u5b9a\u7fa9\u30fb\u5ba3\u8a00\u3092\u884c\u3046\u65b9\u6cd5\u3068\u3057\u3066\u3001var,let,const\u306e3\u7a2e\u985e\u306e\u3084\u308a\u65b9\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u308c\u305e\u308c\u306e\u5909\u6570\u5b9a\u7fa9\u306e\u9055\u3044\u3068\u3001\u30aa\u30b9\u30b9\u30e1\u306e\u4f7f\u3044\u65b9\u306b\u3064\u3044\u3066\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\n<h2>GAS\u306e\u5909\u6570\u306e\u5b9a\u7fa9\u65b9\u6cd5\u306f3\u7a2e\u985e<\/h2>\n<p>Google Apps Script(GAS)\u306fJavascript\u304c\u30d9\u30fc\u30b9\u3068\u306a\u3063\u3066\u3044\u308b\u8a00\u8a9e\u3067\u3059\u3002<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001GAS\u3067\u306e\u5909\u6570\u3092\u5b9a\u7fa9\u3059\u308b\u65b9\u6cd5\u3068\u3057\u3066\u306f\u4ee5\u4e0b\u306e3\u7a2e\u985e\u306e\u65b9\u6cd5\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<ol>\n<li><strong>var(V8\u30e9\u30f3\u30bf\u30a4\u30e0\u4ee5\u524d\u3082\u5bfe\u5fdc)<\/strong><\/li>\n<li>let(V8\u30e9\u30f3\u30bf\u30a4\u30e0\u306e\u307f\u5bfe\u5fdc)<\/li>\n<li>const(V8\u30e9\u30f3\u30bf\u30a4\u30e0\u306e\u307f\u5bfe\u5fdc)<\/li>\n<\/ol>\n<p>1\u3064\u76ee\u306evar\u30b3\u30de\u30f3\u30c9\u306b\u3088\u308b\u5909\u6570\u5ba3\u8a00\u304c\u3001\u3082\u3068\u3082\u3068\u306eGAS\u3067\u306e\u552f\u4e00\u306e\u5909\u6570\u3092\u5b9a\u7fa9\u3059\u308b\u65b9\u6cd5\u3067\u3057\u305f\u3002<\/p>\n<p>\u305d\u3053\u306bGAS\u304cV8\u30e9\u30f3\u30bf\u30a4\u30e0\u306b\u30d0\u30fc\u30b8\u30e7\u30f3\u30a2\u30c3\u30d7\u3055\u308c\u3001ECMAscript\u306b\u5bfe\u5fdc\u3057\u305f\u3053\u3068\u3067\u3001let\u3084const\u3068\u3044\u3063\u305f\u5909\u6570\u5b9a\u7fa9\u306e\u65b9\u6cd5\u3082\u5229\u7528\u53ef\u80fd\u3068\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<h2>\u2460V8\u4ee5\u524d\u306eGAS\u3067\u3082\u5229\u7528\u53ef\u80fd\u306avar\u5909\u6570<\/h2>\n<p>2020\u5e74\u306bGoogle Apps Script(GAS)\u306fV8\u30e9\u30f3\u30bf\u30a4\u30e0\u306b\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u3055\u308c\u307e\u3057\u305f\u304c\u3001\u305d\u308c\u4ee5\u524d\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3067\u5229\u7528\u3067\u304d\u308b\u306e\u304cvar\u5909\u6570\u3067\u3059\u3002<\/p>\n<p><em><strong>var testVal = &#8220;\u30c6\u30b9\u30c8\u5909\u6570&#8221;;<\/strong><\/em><\/p>\n<p>\u305d\u306e\u305f\u3081\u3001\u65b0\u3057\u3044\u30d0\u30fc\u30b8\u30e7\u30f3\u306eGAS\u3067\u3082\u3001\u53e4\u3044\u30d0\u30fc\u30b8\u30e7\u30f3\u306eGAS\u3069\u3061\u3089\u3067\u3082\u5229\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u30cd\u30c3\u30c8\u4e0a\u306eGAS\u306e\u30b3\u30fc\u30c9\u306e\u591a\u304f\u306f2020\u5e74\u3088\u308a\u3082\u524d\u306b\u66f8\u304b\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001\u30cd\u30c3\u30c8\u4e0a\u306eGAS\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u518d\u5229\u7528\u3059\u308b\u5834\u5408\u306b\u306f\u3001var\u3092\u4f7f\u3046\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2>\u2461V8\u304b\u3089\u5229\u7528\u53ef\u80fd\u306alet\u5909\u6570<\/h2>\n<p>let\u5909\u6570\u306fGAS\u306eV8\u30e9\u30f3\u30bf\u30a4\u30e0\u304b\u3089\u5bfe\u5fdc\u3068\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p><em><strong>let testVal = &#8220;\u30c6\u30b9\u30c8\u5909\u6570&#8221;;<\/strong><\/em><\/p>\n<p>var\u30b3\u30de\u30f3\u30c9\u3067\u5b9a\u7fa9\u3057\u305f\u5909\u6570\u3068\u306f\u5f8c\u8ff0\u3059\u308b\u6709\u52b9\u7bc4\u56f2(\u30b9\u30b3\u30fc\u30d7)\u304c\u7570\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>GAS\u306e\u30d9\u30fc\u30b9\u3068\u306a\u3063\u3066\u3044\u308bjavascript\u306f\u73fe\u5728\u3001ECMAscript\u3068\u3044\u3046\u3082\u306e\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>ECMAscript\u3067\u306f\u3001\u5909\u6570\u5ba3\u8a00\u3067\u306fvar\u3082\u5229\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u304c\u3001var\u3088\u308a\u3082let\u3092\u4f7f\u3046\u3053\u3068\u304c\u63a8\u5968\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<h2>\u2462V8\u304b\u3089\u5229\u7528\u53ef\u80fd\u306aconst\u5b9a\u6570<\/h2>\n<p>const\u5909\u6570\u306f\u3001\u5909\u6570\u306e\u4e00\u7a2e\u3067\u5b9a\u6570\u3092\u5ba3\u8a00\u3059\u308b\u30b3\u30de\u30f3\u30c9\u3067\u3059\u3002<\/p>\n<p>const\u3082let\u3068\u540c\u3058\u304f\u3001GAS\u306eV8\u30e9\u30f3\u30bf\u30a4\u30e0\u304b\u3089\u5229\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p><em><strong>const TESTVAL = &#8220;\u30c6\u30b9\u30c8\u5b9a\u6570&#8221;;<\/strong><\/em><\/p>\n<p>\u5b9a\u6570\u3068\u3044\u3046\u540d\u524d\u306e\u901a\u308a\u3001var\u3084let\u306b\u3088\u308b\u5909\u6570\u3068\u306f\u7570\u306a\u308b\u6027\u8cea\u3067<strong>\u300c\u518d\u4ee3\u5165\u304c\u4e0d\u53ef\u80fd\u300d<\/strong>\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><strong>\u300c\u518d\u4ee3\u5165\u304c\u4e0d\u53ef\u80fd\u300d<\/strong>\u3068\u3044\u3046\u306e\u306f\u3001const\u306b\u3088\u308b\u5b9a\u6570\u5ba3\u8a00\u6642\u306b\u4ee3\u5165\u3057\u305f\u5024\u3092\u3042\u3068\u304b\u3089\u66f8\u304d\u63db\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u306a\u3044\u3068\u3044\u3046\u610f\u5473\u3067\u3059\u3002<\/p>\n<p>\u3042\u3089\u304b\u3058\u3081\u3001\u6570\u5024\u3084\u6587\u5b57\u5217\u304c\u6c7a\u307e\u3063\u3066\u304d\u3066\u3001\u5909\u66f4\u304c\u306a\u3044\u6570\u5024\u3092\u5229\u7528\u3057\u305f\u3044\u5834\u5408\u306b\u3001const\u306b\u3088\u3063\u3066\u5b9a\u7fa9\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n<h2>var,let,const\u306e\u5927\u304d\u306a\u9055\u3044\u306f\u30b9\u30b3\u30fc\u30d7\u7bc4\u56f2<\/h2>\n<p>var\u3068let\u3068const\u306e\u4f55\u304c\u9055\u3046\u306e\u3067\u3057\u3087\u3046\u304b\uff1f<\/p>\n<p>3\u3064\u306e\u5909\u6570\u306e\u5927\u304d\u304f\u9055\u3046\u30dd\u30a4\u30f3\u30c8\u306f\u3001\u5909\u6570\u304c\u5bfe\u8c61\u3068\u306a\u308b\u7bc4\u56f2(\u30b9\u30b3\u30fc\u30d7)\u3067\u3059\u3002<\/p>\n<h3>GAS\u30b9\u30b3\u30fc\u30d7\u306f\u5927\u5225\u3059\u308b\u3068\u30ed\u30fc\u30ab\u30eb\u30b9\u30b3\u30fc\u30d7\u3068\u30b0\u30ed\u30fc\u30d0\u30eb\u30b9\u30b3\u30fc\u30d7<\/h3>\n<p>Google Apps Script(GAS)\u306b\u304a\u3044\u3066\u5909\u6570\u30b9\u30b3\u30fc\u30d7\u306f\u5927\u304d\u304f\u5206\u3051\u308b\u3068\u3001\u4ee5\u4e0b\u306e2\u7a2e\u985e\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<ol>\n<li>\u30ed\u30fc\u30ab\u30eb\u30b9\u30b3\u30fc\u30d7<\/li>\n<li>\u30b0\u30ed\u30fc\u30d0\u30eb\u30b9\u30b3\u30fc\u30d7<\/li>\n<\/ol>\n<p>\u30ed\u30fc\u30ab\u30eb\u30b9\u30b3\u30fc\u30d7\u306fGAS\u3067\u5b9a\u7fa9\u3057\u305ffunction\u95a2\u6570\u5185\u3067\u306e\u307f\u6709\u52b9\u7bc4\u56f2\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001\u30ed\u30fc\u30ab\u30eb\u30b9\u30b3\u30fc\u30d7\u306e\u5909\u6570\u306f\u305d\u306e\u95a2\u6570\u5185\u3067\u306e\u307f\u6709\u52b9\u3068\u306a\u3063\u3066\u3044\u3066\u3001\u5225\u306e\u95a2\u6570\u304b\u3089\u53c2\u7167\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n<p><code>function localScopeTest() {<br \/>\n\/\/var\u306b\u3088\u308b\u30ed\u30fc\u30ab\u30eb\u30b9\u30b3\u30fc\u30d7\u3067\u5909\u6570\u3092\u5ba3\u8a00<br \/>\nvar localVal = \"\u30ed\u30fc\u30ab\u30eb\u30b9\u30b3\u30fc\u30d7\u306e\u30c6\u30b9\u30c8\u3067\u3059\";<br \/>\n\/\/\u540c\u3058\u95a2\u6570\u5185\u306e\u30ed\u30fc\u30ab\u30eb\u30b9\u30b3\u30fc\u30d7\u7bc4\u56f2\u306a\u306e\u3067\u3001\u53c2\u7167\u53ef\u80fd<br \/>\nconsole.log(localVal);<br \/>\n}<br \/>\n\/\/localScopeTest\u306e\u5909\u6570\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u95a2\u6570<br \/>\nfunction accessLocalVal(){<br \/>\n\/\/localScopTest\u306e\u5909\u6570\u306f\u30b9\u30b3\u30fc\u30d7\u7bc4\u56f2\u5916\u306a\u306e\u3067\u3001\u53c2\u7167\u4e0d\u53ef<br \/>\nconsole.log(localVal);<br \/>\n}<\/code><\/p>\n<p>\u4e0a\u8a18\u306e\u3088\u3046\u306blocalScopeTest\u95a2\u6570\u3067\u5b9a\u7fa9\u3055\u308c\u305f\u30ed\u30fc\u30ab\u30eb\u5909\u6570\u3092\u5225\u306e\u95a2\u6570(accessLocalVal)\u3067\u53c2\u7167\u3057\u3088\u3046\u3068\u3059\u308b\u3068\u3001\u5909\u6570\u672a\u5b9a\u7fa9\u306e\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3067\u5b9f\u884c\u5931\u6557\u3057\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2451\" src=\"https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/11\/20210101_auto_004.jpg\" alt=\"\" width=\"800\" height=\"402\" srcset=\"https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/11\/20210101_auto_004.jpg 800w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/11\/20210101_auto_004-300x151.jpg 300w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/11\/20210101_auto_004-768x386.jpg 768w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/11\/20210101_auto_004-530x266.jpg 530w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/11\/20210101_auto_004-565x284.jpg 565w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/11\/20210101_auto_004-710x357.jpg 710w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/11\/20210101_auto_004-725x364.jpg 725w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/p>\n<p>\u305d\u308c\u306b\u5bfe\u3057\u3001\u30b0\u30ed\u30fc\u30d0\u30eb\u30b9\u30b3\u30fc\u30d7\u306e\u5909\u6570\u306f\u540c\u3058GAS\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u5185\u3067\u3042\u308c\u3070\u3001\u3069\u306e\u95a2\u6570\u304b\u3089\u3067\u3082\u53c2\u7167\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u30b0\u30ed\u30fc\u30d0\u30eb\u30b9\u30b3\u30fc\u30d7\u306e\u5909\u6570\u306fGAS\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u540c\u3058\u30b9\u30af\u30ea\u30d7\u30c8\u30d5\u30a1\u30a4\u30eb\u306e\u95a2\u6570\u3067\u53c2\u7167\u3067\u304d\u308b\u3053\u3068\u306f\u3082\u3061\u308d\u3093\u3001\u5225\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u30d5\u30a1\u30a4\u30eb\u3067\u5b9a\u7fa9\u3055\u308c\u305f\u30b0\u30ed\u30fc\u30d0\u30eb\u30b9\u30b3\u30fc\u30d7\u3067\u3082\u53c2\u7167\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<p>V8\u30e9\u30f3\u30bf\u30a4\u30e0\u4ee5\u524d\u306evar\u5909\u6570\u306e\u30b9\u30b3\u30fc\u30d7\u7bc4\u56f2\u306f\u3053\u306e\u30ed\u30fc\u30ab\u30eb\u30b9\u30b3\u30fc\u30d7\u3068\u30b0\u30ed\u30fc\u30d0\u30eb\u30b9\u30b3\u30fc\u30d7\u306e2\u7a2e\u985e\u3067\u3001\u5909\u6570\u3092\u5b9a\u7fa9\u3059\u308b\u5834\u6240\u306b\u3088\u3063\u3066\u6c7a\u307e\u308a\u307e\u3057\u305f\u3002<\/p>\n<h3>V8\u30e9\u30f3\u30bf\u30a4\u30e0\u304b\u3089\u30d6\u30ed\u30c3\u30af\u30b9\u30b3\u30fc\u30d7\u304c\u767b\u5834<\/h3>\n<p>V8\u30e9\u30a4\u30f3\u30bf\u30a4\u30e0\u306bGAS\u304c\u30d0\u30fc\u30b8\u30e7\u30f3\u30a2\u30c3\u30d7\u3055\u308c\u305f\u969b\u306b\u3001\u3053\u306e\u5909\u6570\u306e\u30b9\u30b3\u30fc\u30d7\u7bc4\u56f2\u306b\u65b0\u305f\u306b\u300c\u30d6\u30ed\u30c3\u30af\u30b9\u30b3\u30fc\u30d7\u300d\u304c\u767b\u5834\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u3053\u306e\u30d6\u30ed\u30c3\u30af\u30b9\u30b3\u30fc\u30d7\u306f\u30ed\u30fc\u30ab\u30eb\u30b9\u30b3\u30fc\u30d7\u306b\u542b\u307e\u308c\u308b\u30b9\u30b3\u30fc\u30d7\u3067\u3059\u304c\u3001\u30ed\u30fc\u30ab\u30eb\u30b9\u30b3\u30fc\u30d7\u3088\u308a\u3082\u5bfe\u8c61\u7bc4\u56f2\u304c\u30d6\u30ed\u30c3\u30af\u3068\u8a00\u3046\u5358\u4f4d\u306b\u9650\u5b9a\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u30d6\u30ed\u30c3\u30af\u3068\u3044\u3046\u306e\u306f\u3001for\u6587\u3084if\u6587\u306e\u3088\u3046\u306a\u4e2d\u62ec\u5f27\u300c{}\u300d\u3067\u56f2\u307e\u308c\u308b\u7bc4\u56f2\u3092\u610f\u5473\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><code>  \/\/\u3053\u3046\u3057\u305ffor\u6587\u306e\u4e2d\u62ec\u5f27{}\u5185\u304c\u30d6\u30ed\u30c3\u30af<br \/>\nfor(let i=0;i&lt;3;i++){<br \/>\n\/\/\u30d6\u30ed\u30c3\u30af\u30b9\u30b3\u30fc\u30d7\u306e\u5909\u6570\u3092let\u3067\u5ba3\u8a00\u3059\u308b<br \/>\nlet blockVal = \"\u30d6\u30ed\u30c3\u30af\u30b9\u30b3\u30fc\u30d7\u306e\u5909\u6570\";<br \/>\n\/\/\u30d6\u30ed\u30c3\u30af\u30b9\u30b3\u30fc\u30d7\u306e\u7bc4\u56f2\u5185\u306a\u306e\u3067\u3001\u5909\u6570\u3092\u53c2\u7167\u53ef\u80fd<br \/>\nconsole.log(blockVal);<br \/>\n}<\/code><\/p>\n<p>\u30d6\u30ed\u30c3\u30af\u30b9\u30b3\u30fc\u30d7\u306e\u5909\u6570\u306f\u4e2d\u62ec\u5f27{}\u3067\u56f2\u307e\u308c\u305f\u7bc4\u56f2\u3067\u306e\u307f\u6709\u52b9\u3067\u3001\u305d\u308c\u4ee5\u5916\u306e\u4f4d\u7f6e\u3067\u306f\u540c\u3058\u95a2\u6570\u5185\u3067\u3082\u53c2\u7167\u304c\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2450\" src=\"https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/11\/20210101_auto_003.jpg\" alt=\"var\u3068let\u3001const\u306e\u5909\u6570\u306e\u5ba3\u8a00\u30fb\u5b9a\u7fa9\u65b9\u6cd5\u306e\u9055\u3044\u30fb\u4f7f\u3044\u5206\u3051\u3092\u89e3\u8aac\" width=\"1200\" height=\"635\" srcset=\"https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/11\/20210101_auto_003.jpg 1200w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/11\/20210101_auto_003-300x159.jpg 300w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/11\/20210101_auto_003-768x406.jpg 768w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/11\/20210101_auto_003-1024x542.jpg 1024w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/11\/20210101_auto_003-530x280.jpg 530w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/11\/20210101_auto_003-565x299.jpg 565w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/11\/20210101_auto_003-710x376.jpg 710w, https:\/\/auto-worker.com\/blog\/wp-content\/uploads\/2020\/11\/20210101_auto_003-725x384.jpg 725w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/p>\n<p>let\u3084const\u306f\u3053\u306e\u30d6\u30ed\u30c3\u30af\u30b9\u30b3\u30fc\u30d7\u306e\u5909\u6570\u3068\u306a\u3063\u3066\u3044\u308b\u305f\u3081\u3001for\u6587\u3084while\u6587\u306a\u3069\u306e\u30eb\u30fc\u30d7\u5185\u3067\u5b9a\u7fa9\u3057\u305f\u5834\u5408\u3001\u305d\u306e\u30eb\u30fc\u30d7\u5185\u306e\u30b3\u30fc\u30c9\u3067\u306e\u307f\u5909\u6570\u304c\u53c2\u7167\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<p>\u306a\u304a\u3001\u30d6\u30ed\u30c3\u30af\u30b9\u30b3\u30fc\u30d7\u306elet\u3084const\u306f\u3001GAS\u306e\u95a2\u6570\u3092\u5ba3\u8a00\u3057\u305f\u969b\u306e1\u3064\u76ee\u306e\u4e2d\u62ec\u5f27\u3067\u5ba3\u8a00\u3059\u308b\u3068\u3001\u95a2\u6570\u5185\u3067\u53c2\u7167\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2>GAS\u3067\u306e\u5909\u6570\u3092\u5b9a\u7fa9\u3059\u308b\u969b\u306e\u30aa\u30b9\u30b9\u30e1\u65b9\u6cd5<\/h2>\n<p>Google Apps Script(GAS)\u3067\u5909\u6570\u3092\u3069\u306e\u3088\u3046\u306b\u5b9a\u7fa9\u3059\u308c\u3070\u3088\u3044\u306e\u304b\uff1f<\/p>\n<p>\u30aa\u30b9\u30b9\u30e1\u306e\u5909\u6570\u5ba3\u8a00\u306e\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<h3>V8\u306eGAS\u3067\u306flet\u3068const\u63a8\u5968<\/h3>\n<p>\u57fa\u672c\u7684\u306b\u3001V8\u30e9\u30f3\u30bf\u30a4\u30e0\u3092\u6709\u52b9\u5316\u3057\u3066\u3044\u308bGAS\u3067\u306f\u3001let\u3068const\u3092\u4f7f\u3063\u3066\u3001\u5909\u6570\u30fb\u5b9a\u6570\u3092\u5b9a\u7fa9\u3059\u308b\u3053\u3068\u304c\u63a8\u5968\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u306a\u305c\u306a\u3089\u3070\u3001GAS\u306e\u30d9\u30fc\u30b9\u3068\u306a\u3063\u3066\u3044\u308bJavaScript\u3067\u3082var\u306f\u4f7f\u7528\u305b\u305a\u306b\u3001let\u3092\u4f7f\u3046\u3053\u3068\u304c\u63a8\u5968\u3055\u308c\u3066\u3044\u308b\u305f\u3081\u3067\u3059\u3002<\/p>\n<p>\u6700\u8fd1\u51fa\u7248\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u3063\u305fGoogle Apps Script(GAS)\u306e\u66f8\u7c4d\u306f\u3001\u307b\u3068\u3093\u3069\u304cV8\u30e9\u30f3\u30bf\u30a4\u30e0\u5bfe\u5fdc\u306e\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001\u3053\u308c\u304b\u3089GAS\u306e\u30b3\u30fc\u30c9\u3092\u66f8\u304f\u5834\u5408\u306flet\u3068const\u306b\u3088\u308b\u5909\u6570\u30fb\u5b9a\u6570\u306e\u5ba3\u8a00\u6587\u3092\u4f7f\u3046\u306e\u30aa\u30b9\u30b9\u30e1\u3067\u3059\u3002<\/p>\n<h3>V8\u4ee5\u524d\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3067\u306fvar\u4e00\u629e<\/h3>\n<p>\u305f\u3060\u3057\u3001V8\u4ee5\u524d\u306e\u65e7\u30d0\u30fc\u30b8\u30e7\u30f3\u3067\u306flet\u3084const\u306f\u4f7f\u7528\u3067\u304d\u306a\u3044\u305f\u3081\u3001\u5f93\u6765\u306e\u5909\u6570\u5ba3\u8a00\u306evar\u3092\u4f7f\u7528\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>2020\u5e742\u6708\u306bV8\u30e9\u30f3\u30bf\u30a4\u30e0\u306b\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u3055\u308c\u305f\u3082\u306e\u306e\u3001\u307e\u3060V8\u30e9\u30f3\u30bf\u30a4\u30e0\u3092\u6709\u52b9\u306b\u3059\u308b\u3068\u3001\u30b9\u30af\u30ea\u30d7\u30c8\u304c\u30a8\u30e9\u30fc\u3057\u305f\u308a\u3059\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001\u5229\u7528\u3057\u3066\u3044\u308b\u30e9\u30a4\u30d6\u30e9\u30ea\u304cV8\u306b\u5bfe\u5fdc\u3057\u3066\u3044\u306a\u304b\u3063\u305f\u308a\u3001V8\u30e9\u30f3\u30bf\u30a4\u30e0\u3060\u3068\u51e6\u7406\u6642\u9593\u3092\u30aa\u30fc\u30d0\u30fc\u3057\u3066\u3057\u307e\u3046\u30b1\u30fc\u30b9\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u3053\u306e\u3088\u3046\u306b\u5f93\u6765\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u306eGAS\u3092\u5229\u7528\u3059\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b\u5834\u5408\u306f\u3001var\u306b\u3088\u308b\u5909\u6570\u5ba3\u8a00\u304c\u30aa\u30b9\u30b9\u30e1\u3067\u3059\u3002<\/p>\n<p>V8\u30e9\u30f3\u30bf\u30a4\u30e0\u3060\u3063\u305f\u3051\u3069\u3001\u4e0a\u8a18\u306e\u3088\u3046\u306a\u4e8b\u60c5\u3067\u7121\u52b9\u5316\u3057\u305f\u5834\u5408\u306b\u3001let\u3084const\u3092\u5229\u7528\u3057\u3066\u3044\u308b\u3068\u66f8\u304d\u63db\u3048\u304c\u5fc5\u8981\u306b\u306a\u308b\u304b\u3089\u3067\u3059\u3002<\/p>\n<h3>\u521d\u5fc3\u8005\u306f\u307e\u305avar\u3067\u5909\u6570\u5ba3\u8a00\u3059\u308b\u306e\u3082\u30aa\u30b9\u30b9\u30e1<\/h3>\n<p>\u3053\u3053\u307e\u3067\u3001V8\u30e9\u30f3\u30bf\u30a4\u30e0GAS\u306a\u3089let,const\u3001\u5f93\u6765\u7248GAS\u306a\u3089var\u3092\u63a8\u5968\u3068\u7d39\u4ecb\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u305f\u3060\u3001GAS\u521d\u5fc3\u8005\u306b\u3068\u3063\u3066\u3001\u30ed\u30fc\u30ab\u30eb\u30b9\u30b3\u30fc\u30d7\u3084\u30d6\u30ed\u30c3\u30af\u30b9\u30b3\u30fc\u30d7\u306e\u6982\u5ff5\u3092\u7406\u89e3\u3059\u308b\u306e\u304c\u96e3\u3057\u3044\u3053\u3068\u3082\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u5b9f\u969b\u3001\u5909\u6570\u306e\u30b9\u30b3\u30fc\u30d7\u7bc4\u56f2\u304c\u7406\u89e3\u3067\u304d\u306a\u304f\u3066\u82e6\u75db\u306b\u611f\u3058\u3001\u632b\u6298\u3057\u3066\u3057\u307e\u3063\u305f\u4eba\u3082\u3044\u307e\u3057\u305f\u3002<\/p>\n<p>\u3067\u3042\u308c\u3070\u3001\u307e\u305a\u306f\u5236\u9650\u4e8b\u9805\u304c\u5c11\u306a\u3044var\u306b\u7d71\u4e00\u3057\u3066\u3057\u307e\u3046\u306e\u3082\u9078\u629e\u80a2\u306e1\u3064\u3067\u3059\u3002<\/p>\n<p>GAS\u521d\u5fc3\u8005\u306b\u3068\u3063\u3066\u306f\u3001\u5c11\u3057\u3067\u3082\u30b3\u30fc\u30c9\u3092\u66f8\u304f\u3053\u3068\u304c\u4e0a\u9054\u306b\u3064\u306a\u304c\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u308c\u3092\u5909\u6570\u5ba3\u8a00\u306e\u65b9\u6cd5\u3067\u30b0\u30ed\u30fc\u30d0\u30eb\u30b9\u30b3\u30fc\u30d7\u3084\u30d6\u30ed\u30c3\u30af\u30b9\u30b3\u30fc\u30d7\u3067\u59a8\u3052\u306b\u306a\u308b\u306e\u306f\u826f\u304f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<p>var\u306b\u3088\u308b\u5909\u6570\u5ba3\u8a00\u3067\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u3044\u304f\u3046\u3061\u306b\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306e\u7406\u89e3\u529b\u304c\u9ad8\u307e\u308b\u3068\u3001\u81ea\u7136\u3068\u30b9\u30b3\u30fc\u30d7\u3082\u7406\u89e3\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u5909\u6570\u306e\u30b9\u30b3\u30fc\u30d7\u304c\u5206\u304b\u3089\u306a\u3044\u306a\u3089\u3001\u81ea\u7531\u5ea6\u304c\u9ad8\u304f\u3001\u65b0\u65e7GAS\u4e21\u65b9\u3067\u5229\u7528\u53ef\u80fd\u306avar\u30b3\u30de\u30f3\u30c9\u3067\u7d71\u4e00\u3057\u3066\u3057\u307e\u3046\u306e\u3082\u30a2\u30ea\u3067\u3059\u3002<\/p>\n<h2>\u307e\u3068\u3081\u30fb\u7d42\u308f\u308a\u306b<\/h2>\n<p>\u4eca\u56de\u3001Google Apps Script(GAS)\u3067\u5909\u6570\u3092\u5ba3\u8a00\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u89e3\u8aac\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>2020\u5e74\u306bGAS\u306eV8\u30e9\u30f3\u30bf\u30a4\u30e0\u304c\u30ea\u30ea\u30fc\u30b9\u3055\u308c\u305f\u3053\u3068\u3067\u3001\u5f93\u6765\u306evar\u30b3\u30de\u30f3\u30c9\u306b\u3088\u308b\u5909\u6570\u5ba3\u8a00\u306b\u52a0\u3048\u3001let\u3084const\u30b3\u30de\u30f3\u30c9\u3082\u5229\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>let\u30fbconst\u306fvar\u3068\u306f\u5909\u6570\u306e\u6709\u52b9\u7bc4\u56f2\u3067\u3042\u308b\u30b9\u30b3\u30fc\u30d7\u304c\u7570\u306a\u3063\u3066\u304a\u308a\u3001\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u7684\u306b\u306f\u5f93\u6765\u306evar\u3067\u306f\u306a\u304f\u3001let\u3084const\u3092\u4f7f\u3046\u3053\u3068\u304c\u63a8\u5968\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u305f\u3060\u3001\u5909\u6570\u306e\u30b9\u30b3\u30fc\u30d7\u306fGAS\u521d\u5fc3\u8005\u306b\u306f\u7406\u89e3\u304c\u96e3\u3057\u3044\u305f\u3081\u3001\u3053\u3053\u3067\u632b\u6298\u3059\u308b\u3088\u308a\u306fvar\u3092\u4f7f\u3046\u306e\u3082\u9078\u629e\u80a2\u306e1\u3064\u3067\u3059\u3002<\/p>\n<p>\u5909\u6570\u306e\u30b9\u30b3\u30fc\u30d7\u304c\u3088\u304f\u5206\u304b\u3089\u306a\u3044\u5834\u5408\u306f\u3001\u307e\u305avar\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3063\u3066\u30b3\u30fc\u30c9\u3092\u66f8\u304f\u3053\u3068\u306b\u6163\u308c\u3066\u304b\u3089\u3001let\u3084const\u306e\u30d6\u30ed\u30c3\u30af\u30b9\u30b3\u30fc\u30d7\u3092\u7406\u89e3\u3059\u308b\u3088\u3046\u3001\u30b9\u30c6\u30c3\u30d7\u30a2\u30c3\u30d7\u3057\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Google Apps Script(GAS)\u306e\u30b3\u30fc\u30c9\u3067\u5909\u6570\u306e\u5b9a\u7fa9\u30fb\u5ba3\u8a00\u3092\u884c\u3046\u65b9\u6cd5\u3068\u3057\u3066\u3001var,let,const\u306e3\u7a2e\u985e\u306e\u3084\u308a\u65b9\u304c\u3042\u308a\u307e\u3059\u3002 \u305d\u308c\u305e\u308c\u306e\u5909\u6570\u5b9a\u7fa9\u306e\u9055\u3044\u3068\u3001\u30aa\u30b9\u30b9\u30e1\u306e\u4f7f\u3044\u65b9\u306b\u3064\u3044\u3066\u89e3\u8aac\u3057\u307e\u3059\u3002 GAS\u306e [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2450,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[492,14,491,490,489],"class_list":["post-2096","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-gas","tag-const","tag-gas","tag-let","tag-var","tag-489"],"_links":{"self":[{"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2096","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2096"}],"version-history":[{"count":12,"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2096\/revisions"}],"predecessor-version":[{"id":2454,"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/2096\/revisions\/2454"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=\/wp\/v2\/media\/2450"}],"wp:attachment":[{"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2096"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2096"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/auto-worker.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2096"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}