{"id":9914,"date":"2019-03-15T07:00:01","date_gmt":"2019-03-14T22:00:01","guid":{"rendered":"https:\/\/www.itblog.jp\/?p=9914"},"modified":"2019-03-15T07:00:01","modified_gmt":"2019-03-14T22:00:01","slug":"javascript%e3%81%ae%e3%82%af%e3%83%ad%e3%83%bc%e3%82%b8%e3%83%a3%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e8%a7%a3%e8%aa%ac","status":"publish","type":"post","link":"https:\/\/www.itblog.jp\/?p=9914","title":{"rendered":"Javascript\u306e\u30af\u30ed\u30fc\u30b8\u30e3\u306b\u3064\u3044\u3066\u89e3\u8aac"},"content":{"rendered":"<p>Javascript\u306e\u30af\u30ed\u30fc\u30b8\u30e3\u306b\u3064\u3044\u3066\u306e\u89e3\u8aac\u3067\u3059\u3002<\/p>\n<h2>Javascirpt\u306e\u30af\u30ed\u30fc\u30b8\u30e3\u3068\u306f\u4f55\u304b<\/h2>\n<p>Javascript\u306e\u30af\u30ed\u30fc\u30b8\u30e3\u3068\u306f\u4f55\u304b\u3002<\/p>\n<p>\u79c1\u306e\u7406\u89e3\u3067\u306f<\/p>\n<p>\u95a2\u6570\u306e\u4e2d\u3067\u95a2\u6570\u3092\u5b9a\u7fa9\u3057\u305f\u3082\u306e<\/p>\n<p>\u3068\u3044\u3046\u7406\u89e3\u3067\u3059\u3002<br \/>\n(\u3042\u304f\u307e\u3067\u79c1\u306e\u7406\u89e3\u3067\u3059)<\/p>\n<p>\u307e\u305a\u3001\u57fa\u672c\u7684\u306a\u3068\u3053\u308d\u3067<\/p>\n<p>\u30fb\u3000\u95a2\u6570\u3092\u5b9a\u7fa9\u3059\u308b\u3068\u3001\u95a2\u6570\u5185\u3067\u5b9a\u7fa9\u3057\u305f\u5909\u6570\u306f\u95a2\u6570\u5916\u90e8\u304b\u3089\u53c2\u7167\u3067\u304d\u306a\u3044<\/p>\n<p>\u3068\u3044\u3046\u6027\u8cea\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n\u3053\u308c\u306f\u307b\u3068\u3093\u3069\u306e\u4eba\u304c\u77e5\u3063\u3066\u3044\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"Null\">\r\nfunction func() {\r\n  var value = 1;\r\n  console.log(value);\r\n}\r\nfunc(); \/\/ 1\r\nconsole.log(value); \/\/ undefined\r\n<\/pre>\n<p>\u4e0a\u8a18\u306e\u3088\u3046\u306a\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u5834\u5408\u3001\u95a2\u6570\u3092\u5b9f\u884c\u3057\u305f\u5834\u5408\u3001\u5b9f\u884c\u7d50\u679c\u306f<br \/>\n1\u306b\u306a\u308a\u307e\u3059\u304c\u3001\u95a2\u6570\u5185\u306e\u5909\u6570\u3092\u51fa\u529b\u3057\u305f\u5834\u5408\u3001<br \/>\n\u53c2\u7167\u3067\u304d\u3066\u3044\u307e\u305b\u3093\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"Null\">\r\nfunction func() {\r\n  var value = 1;\r\n\r\n  function innerFunc() {\r\n    value++;\r\n  }\r\n  innerFunc();\r\n  console.log(value); \/\/ 2\r\n}\r\nfunc();\r\n<\/pre>\n<p>\u4e0a\u8a18\u306e\u3088\u3046\u306a\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u5834\u5408\u3001\u95a2\u6570\u306e\u5185\u90e8\u3067innerFunc\u3068\u3044\u3046\u95a2\u6570\u3092\u5b9a\u7fa9\u3057\u3066\u95a2\u6570\u5185\u3067\u5b9f\u884c\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n\u3053\u306einnerFUnc\u3092\u30af\u30ed\u30fc\u30b8\u30e3\u3068\u3044\u3044\u307e\u3059\u3002<\/p>\n<p>innerFunc\u5185\u3067\u306f\u3001\u5916\u5074\u306e\u95a2\u6570\uff08\u30a8\u30f3\u30af\u30ed\u30fc\u30b8\u30e3\uff09\u3067\u5b9a\u7fa9\u3057\u3066\u3044\u308b<br \/>\n\u5909\u6570value\u3092\u547c\u3073\u51fa\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u305d\u306e\u5024\u3092\u53c2\u7167\u3067\u304d\u3066\u3044\u308b\u3060\u3051\u3067\u306a\u304f\u3001<br \/>\n\u66f4\u65b0\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3064\u307e\u308a\u3001javascript\u3067\u306f\u3001\u95a2\u6570\u306e\u4e2d\u3067\u5b9a\u7fa9\u3055\u308c\u305f\u95a2\u6570\u306e\u4ed5\u69d8\u306f\u901a\u5e38\u306e<br \/>\n\u95a2\u6570\u3068\u3001\u305d\u306e\u5916\u5074\u306e\u9818\u57df\u3068\u9055\u3044\u3001\u305d\u306e\u95a2\u6570\u5185\u90e8\u3067\u5909\u6570\u3092\u53c2\u7167\u3057\u305f\u308a\u3001\u66f4\u65b0<br \/>\n\u3057\u305f\u308a\u3067\u304d\u308b\u306e\u3067\u3059\u3002<\/p>\n<p>\u3053\u306e\u3088\u3046\u306a\u4ed5\u7d44\u307f\u3092\u5229\u7528\u3057\u3066\u3001\u95a2\u6570\u3092\u5b9a\u7fa9\u3059\u308b\u969b\u306b\u4f7f\u7528\u3059\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u306e\u3067\u3001<br \/>\n\u6027\u8cea\u3068\u3057\u3066\u899a\u3048\u3066\u304a\u304f\u3068\u826f\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<h2>\u3069\u306e\u3088\u3046\u306a\u3068\u304d\u306b\u4f7f\u3046\u306e\u304b\uff1f<\/h2>\n<p>\u4e0a\u8a18\u306e\u30af\u30ed\u30fc\u30b8\u30e3\u306e\u4ed5\u7d44\u307f\u3092\u4f7f\u3046\u3068\u3001\u95a2\u6570\u5185\u306e\u5909\u6570\u306e\u5024\u3092\u7dad\u6301\u3057\u305f\u307e\u307e\u3001<br \/>\n\u305d\u306e\u95a2\u6570\u5185\u306e\u5024\u3092\u66f4\u65b0\u3059\u308b\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u304b\u3051\u305f\u308a\u3057\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u95a2\u6570\u5185\u3067\u5b9a\u7fa9\u3057\u305f\u5909\u6570\u3092\u3001\u305d\u306e\u95a2\u6570\u5185\u306e\u95a2\u6570\u3092\u5b9a\u7fa9\u3057\u3066\u8fd4\u3059\u3088\u3046\u306a<br \/>\n\u95a2\u6570\u306b\u3059\u308b\u3053\u3068\u3067\u3001\u95a2\u6570\u306e\u5916\u3067\u5909\u6570\u3092\u5b9a\u7fa9\u3057\u3066\u66f4\u65b0\u3057\u305f\u308a\u3057\u306a\u304f\u3066\u3082\u3001<br \/>\n\u95a2\u6570\u3092\u5b9f\u884c\u3059\u308b\u5ea6\u306b\u95a2\u6570\u3092\u5b9f\u884c\u3067\u304d\u305f\u308a\u3059\u308b\u308f\u3051\u3067\u3059\u3002<\/p>\n<p>\u66f8\u304d\u65b9\u306b\u3088\u3063\u3066\u306f\u30af\u30ed\u30fc\u30b8\u30e3\u3092\u4f7f\u308f\u306a\u304f\u3066\u3082\u5b9f\u88c5\u3067\u304d\u308b\u5834\u5408\u3082\u3042\u308a\u307e\u3059\u304c\u3001<br \/>\n\u30b3\u30fc\u30c9\u304c\u3088\u308a\u30b7\u30f3\u30d7\u30eb\u306b\u306a\u3063\u305f\u308a\u3001\u4fbf\u5229\u306a\u30b1\u30fc\u30b9\u304c\u3042\u308b\u3088\u3046\u3067\u3059\u3002<br \/>\n\uff08\u672a\u3060\u306b\u305d\u3046\u3044\u3046\u5834\u9762\u306b\u906d\u9047\u3057\u305f\u3053\u3068\u304c\u306a\u3044\u306e\u3067\u5206\u304b\u3089\u306a\u3044\u30fb\u30fb\u30fb\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Javascript\u306e\u30af\u30ed\u30fc\u30b8\u30e3\u306b\u3064\u3044\u3066\u306e\u89e3\u8aac\u3067\u3059\u3002 Javascirpt\u306e\u30af\u30ed\u30fc\u30b8\u30e3\u3068\u306f\u4f55\u304b Javascript\u306e\u30af\u30ed\u30fc\u30b8\u30e3\u3068\u306f\u4f55\u304b\u3002 \u79c1\u306e\u7406\u89e3\u3067\u306f \u95a2\u6570\u306e\u4e2d\u3067\u95a2\u6570\u3092\u5b9a\u7fa9\u3057\u305f\u3082\u306e \u3068\u3044\u3046\u7406\u89e3\u3067\u3059\u3002 (\u3042\u304f\u307e\u3067\u79c1\u306e\u7406\u89e3 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[169,131],"tags":[],"class_list":["post-9914","post","type-post","status-publish","format-standard","hentry","category-javascript","category-131"],"_links":{"self":[{"href":"https:\/\/www.itblog.jp\/index.php?rest_route=\/wp\/v2\/posts\/9914","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.itblog.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.itblog.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.itblog.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.itblog.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=9914"}],"version-history":[{"count":0,"href":"https:\/\/www.itblog.jp\/index.php?rest_route=\/wp\/v2\/posts\/9914\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.itblog.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9914"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.itblog.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=9914"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.itblog.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=9914"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}