{"id":10455,"date":"2018-10-29T09:00:01","date_gmt":"2018-10-29T00:00:01","guid":{"rendered":"https:\/\/www.agent-grow.com\/self20percent\/?p=10455"},"modified":"2018-10-25T10:40:07","modified_gmt":"2018-10-25T01:40:07","slug":"what-js-callback-function","status":"publish","type":"post","link":"https:\/\/www.agent-grow.com\/self20percent\/2018\/10\/29\/what-js-callback-function\/","title":{"rendered":"JavaScript \u306e\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u95a2\u6570\u3063\u3066\u7d50\u5c40\u4f55\u8005\u306a\u3093\u3060\u3088\uff01\u3068\u601d\u3063\u3066\u308b\u4eba\u306b\u6367\u3052\u308b\u89e3\u8aac"},"content":{"rendered":"<h1>\u4eca\u56de\u306f\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u95a2\u6570\u306e\u304a\u8a71\u3067\u3059<\/h1>\n<p>\u3053\u3093\u306b\u3061\u306f\u3001\u6c5f\u5d5c\u3067\u3059\u3002<br \/>\nJavaScript \u66f8\u3044\u3066\u307e\u3059\u304b\uff01<br \/>\n\u66f8\u3044\u3066\u306a\u3044\u3067\u3059\u304b\uff1f<\/p>\n<p>JavaScript \u306f\u82e5\u5e72\u3001 \u4ed6\u306e\u8a00\u8a9e\u3068\u6bd4\u3079\u3066\u3068\u3063\u3064\u304d\u306b\u304f\u3044\u90e8\u5206\u304c\u3042\u3063\u305f\u308a\u3059\u308b\u8a00\u8a9e\u3060\u3068\u601d\u308f\u308c\u3066\u3044\u308b\u3088\u3046\u306b\u601d\u3044\u307e\u3059\u3002<br \/>\n\u5b9f\u969b\u3001\u4eca\u3067\u3053\u305d JavaScript \u306f\u975e\u5e38\u306b\u4eba\u6c17\u306a\u8a00\u8a9e\u3067\u3059\u304c\u3001<br \/>\n\u5143\u3005\u30ac\u30c3\u30c4\u30ea\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3092\u3059\u308b\u305f\u3081\u306e\u8a00\u8a9e\u3067\u306f\u306a\u304f\u3001<br \/>\n\u30d6\u30e9\u30a6\u30b6\u4e0a\u3067\u7c21\u5358\u306a\u51e6\u7406\u3092\u3055\u305b\u308b\u305f\u3081\u306b\u4f5c\u3089\u308c\u305f\u8a00\u8a9e\u306a\u3093\u3067\u3059\u306d\u3002<\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001Java \u306e\u3088\u3046\u306a\u3057\u3063\u304b\u308a\u3068\u3057\u305f\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u7d44\u3080\u3053\u3068\u3092\u8003\u3048\u3066\u4f5c\u3089\u308c\u305f\u8a00\u8a9e\u3092\u89e6\u3089\u308c\u305f\u65b9\u304b\u3089\u3057\u3066\u307f\u308b\u3068<br \/>\n\u4f7f\u3044\u306b\u304f\u3044\uff01\u826f\u304f\u308f\u304b\u3089\u306a\u3044\uff01\u3068\u601d\u3046\u3068\u3053\u308d\u304c\u7d50\u69cb\u3042\u3063\u305f\u308a\u3059\u308b\u306e\u3067\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u30b3\u30ec\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsetTimeout(function() {\n  console.log(&amp;#039;hello!&amp;#039;);\n}, 1000);\n<\/pre>\n<p>\u51e6\u7406\u3092\u9045\u3089\u305b\u308b\u6642\u306b\u4f7f\u3046 <code>setTimeout<\/code> \u3067\u3059\u304c\u3001\u3053\u306e\u6642\u306b\u4f7f\u308f\u308c\u308b\u306e\u304c\u3001<br \/>\n\u5f15\u6570\u306e\u6240\u306b\u95a2\u6570\u3092\u66f8\u304f\u300c\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u95a2\u6570\u300d\uff01<br \/>\n\u306a\u3093\u3067\u3053\u3093\u306a\u66f8\u304d\u65b9\u306b\u306a\u308b\u306e\u304b\u3001\u8003\u3048\u305f\u3053\u3068\u3042\u308a\u307e\u3059\u304b\uff1f<\/p>\n<p>\u4eca\u56de\u306f\u3001\u3044\u307e\u3044\u3061\u610f\u5473\u304c\u5206\u304b\u3089\u306a\u3044\u307e\u307e\u4f7f\u308f\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u591a\u305d\u3046\u306a\uff08\u5b9f\u969b\u79c1\u3082\u6614\u306f\u305d\u3046\u3067\u3057\u305f\uff09<br \/>\n\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u95a2\u6570\u306b\u3064\u3044\u3066\u89e3\u8aac\uff01\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<h1>\u305d\u306e\u524d\u306b\u2026\u7c21\u5358\u306b JavaScript \u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3068\u95a2\u6570\u306b\u3064\u3044\u3066\u306e\u304a\u8a71<\/h1>\n<h2>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u30ea\u30c6\u30e9\u30eb\u306f\u5024\u3092\u307e\u3068\u3081\u305f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/h2>\n<p>\u305d\u306e\u524d\u306b\u3001\u8efd\u304f JavaScript \u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3068\u95a2\u6570\u306e\u7acb\u3061\u4f4d\u7f6e\u306b\u3064\u3044\u3066\u304a\u8a71\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u30ea\u30c6\u30e9\u30eb\u3001\u3068\u3044\u3046\u8a00\u8449\u306f\u3082\u3057\u304b\u3057\u305f\u3089\u805e\u304d\u306a\u308c\u306a\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001<br \/>\nJavaScript \u3092\u4f7f\u3063\u305f\u3053\u3068\u304c\u3042\u308b\u65b9\u306a\u3089\u307b\u307c\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u30ea\u30c6\u30e9\u30eb\u3082\u4f7f\u3063\u305f\u3053\u3068\u304c\u3042\u308b\u3067\u3057\u3087\u3046\u3002<\/p>\n<p>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u30ea\u30c6\u30e9\u30eb\u3068\u306f\u3001\u5024\u3092\u4e2d\u30ab\u30c3\u30b3\u3067\u307e\u3068\u3081\u305f\u30e4\u30c4\u3067\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nvar obj = {\n  val1: &amp;#039;hoge&amp;#039;,\n  val2: &amp;#039;fuga&amp;#039;\n}\n<\/pre>\n<p>\u3053\u3093\u306a\u611f\u3058\u306e\u3084\u3064\u3067\u3059\uff01<br \/>\n\u4eca\u56de\u306f\u4f5c\u3063\u305f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u30ea\u30c6\u30e9\u30eb\u3092 obj \u5909\u6570\u306b\u683c\u7d0d\u3057\u3066\u3044\u308b\u306e\u3067\u3001<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nconsole.log(obj.val1) \/\/ \u300choge\u300d \u3068\u51fa\u529b\u3055\u308c\u308b\n<\/pre>\n<p>\u3053\u3093\u306a\u611f\u3058\u3067\u4f7f\u3044\u307e\u3059\u3088\u306d\u3002<\/p>\n<p>\u3053\u3053\u3067\u91cd\u8981\u306a\u306e\u306f\u3001\u300c\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u30ea\u30c6\u30e9\u30eb\u306f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u3042\u308a\u3001\u5909\u6570\u306b\u683c\u7d0d\u3067\u304d\u308b\u300d\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002<\/p>\n<h2>\u95a2\u6570\u3068\u306f\u8907\u6570\u306e\u51e6\u7406\u3092\u307e\u3068\u3081\u305f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/h2>\n<p>JavaScript \u306b\u3064\u3044\u3066\u52c9\u5f37\u3059\u308b\u3068\u304d\u306b\u306f\u304a\u4e16\u8a71\u306b\u306a\u308b MDN \u304b\u3089\u89e3\u8aac\u3092\u5f15\u3044\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<blockquote><p>\u95a2\u6570\u306f JavaScript \u306e\u57fa\u672c\u7684\u306a\u69cb\u6210\u8981\u7d20\u306e\u3072\u3068\u3064\u3067\u3059\u3002\u307e\u305f\u95a2\u6570\u306f\u3001JavaScript \u306e\u624b\u7d9a\u304d \u2015 \u3064\u307e\u308a\u3001\u30bf\u30b9\u30af\u3084\u5024\u8a08\u7b97\u3092\u5b9f\u884c\u3059\u308b\u6587\u306e\u96c6\u307e\u308a\u3067\u3059\u3002\u95a2\u6570\u3092\u4f7f\u3046\u306b\u306f\u3001\u547c\u3073\u51fa\u3057\u305f\u3044\u30b9\u30b3\u30fc\u30d7\u5185\u306e\u3069\u3053\u304b\u3067\u305d\u308c\u3092\u5b9a\u7fa9\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p><\/blockquote>\n<p><cite>https:\/\/developer.mozilla.org\/ja\/docs\/Web\/JavaScript\/Guide\/Functions<\/cite><\/p>\n<p>\u306a\u308b\u307b\u3069\u2026\uff1f<br \/>\n\u3053\u308c\u3060\u3051\u8aad\u3080\u3068\u5206\u304b\u308b\u3088\u3046\u3067\u5206\u304b\u3089\u306a\u3044\u3088\u3046\u306a\u89e3\u8aac\u3067\u3059\u304c\u3001\u30dd\u30a4\u30f3\u30c8\u306f\u3053\u3053<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n\u30bf\u30b9\u30af\u3084\u5024\u8a08\u7b97\u3092\u5b9f\u884c\u3059\u308b\u6587\u306e\u96c6\u307e\u308a\u3067\u3059\u3002\n<\/pre>\n<p>\u5358\u7d14\u306b\u5b9f\u884c\u3059\u308b\u6587\u3092\u307e\u3068\u3081\u305f\u3082\u306e\u3001\u3068\u3044\u3046\u8a8d\u8b58\u3067\u3059\u3002<br \/>\n\u3061\u306a\u307f\u306b\u6587\u3068\u306f\u51e6\u7406\u306e 1 \u30b9\u30c6\u30c3\u30d7\u3067\u3059\u3002<\/p>\n<p>\u3067\u3059\u304b\u3089\u4f8b\u3048\u3070\u3001<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nfunction add (a, b) {\n  var result = a + b;\n  console.log(&amp;#039;\u5408\u8a08\u5024\u306f&amp;#039; + result + &amp;#039;\u3067\u3059&amp;#039;);\n  return a + b;\n}\n<\/pre>\n<p>\u3053\u308c\u306f\u3001<\/p>\n<ul>\n<li>\u4e0e\u3048\u3089\u308c\u305f\u4e8c\u3064\u306e\u6570\u3092\u8db3\u3057\u3066<\/li>\n<li>\u5408\u8a08\u5024\u3092\u30b3\u30f3\u30bd\u30fc\u30eb\u306b\u51fa\u529b\u3057<\/li>\n<li>\u5408\u8a08\u5024\u3092\u8fd4\u3059<\/li>\n<\/ul>\n<p>\u3068\u3044\u3046\u51e6\u7406\u3092\u307e\u3068\u3081\u3066\u3001 <code>add<\/code> \u3068\u3044\u3046\u540d\u524d\u3092\u4ed8\u3051\u305f\u3082\u306e\u3001\u3068\u3044\u3046\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u3055\u3089\u306b\u3001\u77e5\u3063\u3066\u304a\u3044\u3066\u3044\u305f\u3060\u304d\u305f\u306e\u306f\u3001\u95a2\u6570\u3082\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u3042\u308b\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002<br \/>\n\u5148\u7a0b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u30ea\u30c6\u30e9\u30eb\u306f\u5024\u3092\u307e\u3068\u3081\u305f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u3042\u308b\u3068\u304a\u8a71\u3057\u307e\u3057\u305f\u304c\u3001<br \/>\n\u95a2\u6570\u306f\u51e6\u7406\u3092\u307e\u3068\u3081\u305f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306a\u306e\u3067\u3059\u306d\uff01<\/p>\n<p>\u3069\u3061\u3089\u3082\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3068\u3044\u3046\u3053\u3068\u306f\u2026\uff1f<\/p>\n<h2>\u95a2\u6570\u3082\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306a\u306e\u3067\u5909\u6570\u306b\u683c\u7d0d\u3067\u304d\u308b<\/h2>\n<p>\u3053\u306e\u8fba\u308a\u304b\u3089 Java \u7b49\u3068\u306f\u5c11\u3057\u7570\u306a\u308a\u3001\u5c11\u3057\u7406\u89e3\u3057\u3065\u3089\u3044\u3068\u3053\u308d\u3067\u306f\u3042\u308a\u307e\u3059\u304c\u2026<\/p>\n<p>\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u30ea\u30c6\u30e9\u30eb\u3082\u95a2\u6570\u3082\u3001\u4f55\u304b\u3092\u307e\u3068\u3081\u305f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u3042\u308b\u3053\u3068\u3092\u304a\u8a71\u3057\u307e\u3057\u305f\u3002<br \/>\n\u3068\u3053\u308d\u3067\u5148\u7a0b\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u30ea\u30c6\u30e9\u30eb\u306f\u5909\u6570\u306b\u683c\u7d0d\u3067\u304d\u308b\u3053\u3068\u3092\u304a\u898b\u305b\u3057\u307e\u3057\u305f\u3088\u306d\uff1f<\/p>\n<p>\u95a2\u6570\u3082\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u3059\u304b\u3089\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u30ea\u30c6\u30e9\u30eb\u540c\u69d8\u306b\u5909\u6570\u306b\u683c\u7d0d\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br \/>\n\u3088\u3063\u3066\u3001<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nvar add = function (a, b) {\n  var result = a + b;\n  console.log(&amp;#039;\u5408\u8a08\u5024\u306f&amp;#039; + result + &amp;#039;\u3067\u3059&amp;#039;);\n  return a + b;\n}\n<\/pre>\n<p>\u3053\u3093\u306a\u66f8\u304d\u65b9\u304c\u53ef\u80fd\u3067\u3059\u3002<br \/>\n\u3064\u307e\u308a\u3001 \u5148\u7a0b\u306e <code>add<\/code> \u3068\u540c\u3058\u95a2\u6570\uff08\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\uff09\u3092\u4f5c\u3063\u3066\u3001\u305d\u308c\u3092 <code>add<\/code> \u5909\u6570\u306b\u683c\u7d0d\u3057\u3066\u3044\u308b\u306e\u3067\u3059\u306d\u3002<\/p>\n<p>\u3053\u3053\u307e\u3067 OK \u3067\u3059\u306d\uff1f<\/p>\n<h1>\u95a2\u6570\u306f\u5f15\u6570\u3092\u6e21\u3059\u3068\u767a\u52d5\u3059\u308b<\/h1>\n<p>\u3055\u3066\u3001<\/p>\n<ul>\n<li>\u95a2\u6570\u306f\u5358\u7d14\u306b\u51e6\u7406\u3092\u307e\u3068\u3081\u305f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u3042\u308b<\/li>\n<li>\u95a2\u6570\u306f\u5909\u6570\u306b\u683c\u7d0d\u3067\u304d\u308b<\/li>\n<\/ul>\n<p>\u3068\u3044\u3046\u3053\u3068\u3092\u304a\u8a71\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u305d\u3046\u3059\u308b\u3068\u3001\u4e00\u3064\u7591\u554f\u304c\u751f\u307e\u308c\u3066\u304f\u308b\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u300c\u5909\u6570\u306b\u683c\u7d0d\u3057\u305f\u95a2\u6570\u306f\u3069\u3046\u3084\u3063\u3066\u5b9f\u884c\u3059\u308b\u3093\u3060\uff1f\u300d<br \/>\n\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u306d\u3002<\/p>\n<p>\u3053\u308c\u306f\u5358\u7d14\u3067\u3001\u95a2\u6570\u306b\u306f\u5f15\u6570\u3092\u4e0e\u3048\u3066\u3042\u3052\u308b\u3053\u3068\u3067\u5b9f\u884c\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3067\u306f\u3001\u5148\u307b\u3069\u306e add \u95a2\u6570\u3092\u5b9f\u884c\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br \/>\n\u5f15\u6570\u306e\u4e0e\u3048\u65b9\u306f\u95a2\u6570\u306e\u5f8c\u308d\u306b <code>(\u5024)<\/code> \u3092\u304f\u3063\u3064\u3051\u3066\u3042\u3052\u308c\u3070 OK \u3067\u3059\u3002<\/p>\n<p>\u3064\u307e\u308a\u3001<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nadd(2, 3)\n<\/pre>\n<p>\u3053\u3046\u3067\u3059\u306d\u3002<\/p>\n<p>\u95a2\u6570\u3092\u5909\u6570\u306b\u683c\u7d0d\u3057\u3066\u3044\u308b\u5834\u5408\u306f\u3069\u3046\u3067\u3057\u3087\u3046\u304b\u3002<br \/>\n\u3053\u3061\u3089\u3082\u307e\u3063\u305f\u304f\u540c\u3058\u3088\u3046\u306b\u3001\u5909\u6570\u540d\u306e\u5f8c\u308d\u306b <code>(\u5024)<\/code> \u3092\u304f\u3063\u3064\u3051\u3066\u3042\u3052\u308c\u3070 OK \u3067\u3059\u3002<\/p>\n<p>\u306a\u305c\u306a\u3089\u3001\u5909\u6570\u306f\u547c\u3073\u51fa\u3055\u308c\u305f\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u4e2d\u8eab\u3092\u5c55\u958b\u3057\u307e\u3059\u306e\u3067\u3001<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nadd(2, 3)\n<\/pre>\n<p>\u306f<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n(function (a, b) {\n  var result = a + b;\n  console.log(&amp;#039;\u5408\u8a08\u5024\u306f&amp;#039; + result + &amp;#039;\u3067\u3059&amp;#039;);\n  return a + b;\n})(2, 3)\n<\/pre>\n<p>\u3068\u540c\u3058\u3067\u3059\u306d\uff01\uff08add \u5909\u6570\u306e\u4e2d\u8eab\u306e\u584a\u3092\u793a\u3059\u70ba\u306b () \u3067\u304f\u304f\u3063\u3066\u3042\u308a\u307e\u3059\uff09<\/p>\n<p>\u3053\u308c\u306f\u5373\u3061\u3001\u95a2\u6570\u306e\u5f8c\u308d\u306b <code>(\u5024)<\/code> \u3092\u304f\u3063\u3064\u3051\u3066\u3044\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u306e\u3067\u3001<br \/>\n\u3053\u308c\u3067\u95a2\u6570\u3092\u5b9f\u884c\u3067\u304d\u308b\u3001\u3068\u3044\u3046\u308f\u3051\u3067\u3059\uff01<\/p>\n<p>\u3053\u306e\u5f62\u3001\u3069\u3053\u304b\u3067\u898b\u305f\u899a\u3048\u304c\u3042\u308a\u307e\u305b\u3093\u304b\uff1f<\/p>\n<p>\u305d\u3046\u3001\u95a2\u6570\u3092\u4f5c\u3063\u3066\u3059\u3050\u5b9f\u884c\u3055\u305b\u308b\u3001\u5373\u6642\u95a2\u6570\u3067\u3059\u306d\uff01<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n(function (){\n  console.log(&amp;#039;hello world!&amp;#039;)\n})()\n<\/pre>\n<p>\u5373\u6642\u95a2\u6570\u3082\u4e00\u7dd2\u3067\u3001\u95a2\u6570\u306e\u5f8c\u308d\u306b\u5f15\u6570\u3092\u4e0e\u3048\u3066\u3042\u3052\u3066\u3044\u308b\u3060\u3051\u3060\u3063\u305f\u306e\u3067\u3059\u3002<br \/>\n\u305f\u3060\u3001\u3053\u306e\u3088\u3046\u306b\u95a2\u6570\u304c\u5f15\u6570\u3092\u4f55\u3082\u53d6\u3089\u306a\u3044\u5834\u5408\u306f <code>()<\/code> \u3068\u3001\u304b\u3063\u3053\u306e\u4e2d\u8eab\u304c\u7a7a\u306b\u306a\u308b\u3060\u3051\u3067\u3001<br \/>\n\u95a2\u6570 + \u5f15\u6570\u3092\u6e21\u3059\u5f62\u306b\u5f93\u3063\u3066\u3044\u305f\u3060\u3051\u306a\u306e\u3067\u3059\u306d\uff01<\/p>\n<h1>\u3044\u3088\u3044\u3088\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u95a2\u6570<\/h1>\n<p>\u3055\u3066\u3001\u3053\u3053\u307e\u3067\u9577\u3044\u65c5\u3067\u3057\u305f\u306d\u3002<br \/>\n\u3044\u3088\u3044\u3088\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u95a2\u6570\u306b\u3064\u3044\u3066\u8003\u3048\u3066\u307f\u307e\u3057\u3087\u3046\uff01<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsetTimeout(function() {\n  console.log(&amp;#039;hello!&amp;#039;);\n}, 1000);\n<\/pre>\n<p>\u5143\u3005\u3001\u3053\u3093\u306a\u5f62\u306e\u95a2\u6570\u3092\u8003\u3048\u3066\u3044\u307e\u3057\u305f\u3088\u306d\u3002<br \/>\n\u305d\u308c\u3067\u306f\u3001\u3053\u306e setTimeout \u95a2\u6570\u3092\u3069\u306e\u3088\u3046\u306b\u3057\u305f\u3089\u4f5c\u308c\u308b\u304b\u3001\u8003\u3048\u3066\u307f\u307e\u3057\u3087\u3046\u3002<br \/>\n\uff08\u4ee5\u4e0b\u306f\u672c\u5f53\u306e setTimeout \u306e\u5b9f\u88c5\u3068\u306f\u7570\u306a\u308a\u307e\u3059\u3002\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u95a2\u6570\u3092\u3069\u306e\u3088\u3046\u306b\u5b9f\u73fe\u3057\u3066\u3044\u308b\u304b\u3001\u3068\u3044\u3046\u70b9\u306b\u3064\u3044\u3066\u898b\u3066\u304f\u3060\u3055\u3044\uff09<\/p>\n<p>\u307e\u305a\u3001 <code>setTimeout<\/code> \u3092\u5b9a\u7fa9\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u306e\u3067\u3001<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nfunction setTimeout(fn, time) {\n}\n<\/pre>\n<p>\u3053\u3093\u306a\u95a2\u6570\u5b9a\u7fa9\u3092\u8003\u3048\u307e\u3057\u3087\u3046\u3002<br \/>\n\u5f15\u6570\u3068\u3057\u3066\u306f\u4e00\u3064\u76ee\u306b\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u95a2\u6570\u3092\u3001\u4e8c\u3064\u76ee\u306b\u9045\u5ef6\u3055\u305b\u308b\u6642\u9593\u3092\u5165\u308c\u307e\u3059\u3002<\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u306f\u3001<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nfunction setTimeout(fn, time) {\n  \/\/ sleep(time) : time \u306b\u6307\u5b9a\u3055\u308c\u305f\u6642\u9593\u3060\u3051\u51e6\u7406\u3092\u5f85\u3064\n  \/\/ \u95a2\u6570\u5b9f\u884c\n}\n<\/pre>\n<p>\u3053\u3093\u306a\u611f\u3058\u306b\u306a\u308c\u3070 OK \u3068\u3044\u3046\u3053\u3068\u3067\u3059\u306d<br \/>\n\uff08JavaScript \u306b\u306f sleep \u95a2\u6570\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u3042\u304f\u307e\u3067\u30a4\u30e1\u30fc\u30b8\u3067\u3059\u3088\uff09<\/p>\n<p>\u95a2\u6570\u5b9f\u884c\u306f\u5f15\u6570\u3092\u4e0e\u3048\u3066\u3042\u3052\u308c\u3070\u3088\u304b\u3063\u305f\u306e\u3067\u3001<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nfunction setTimeout(fn, time) {\n  \/\/ sleep(time) : time \u306b\u6307\u5b9a\u3055\u308c\u305f\u6642\u9593\u3060\u3051\u51e6\u7406\u3092\u5f85\u3064\n  fn()\n}\n<\/pre>\n<p>\u3068\u3057\u307e\u3057\u3087\u3046\u304b\u3002<br \/>\n\u3053\u3046\u3059\u308b\u3068\u3001\u3059\u306a\u308f\u3061\u6700\u521d\u306e<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsetTimeout(function() {\n  console.log(&amp;#039;hello!&amp;#039;);\n}, 1000);\n<\/pre>\n<p>\u3053\u308c\u306f<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nfunction setTimeout(fn, time) {\n  \/\/ sleep(1000) -&amp;gt; 1000 \u30df\u30ea\u79d2\u3060\u3051\u51e6\u7406\u3092\u5f85\u3064\n  (function() {\n    console.log(&amp;#039;hello!&amp;#039;);\n  })()\n}\n<\/pre>\n<p>\u3053\u3046\u306a\u308a\u307e\u3059\u3002<br \/>\n\u95a2\u6570\u306e\u5f8c\u308d\u306b\u5f15\u6570\u3092\u4e0e\u3048\u3066\u3044\u308b\u306e\u3067\u3001\u78ba\u304b\u306b\u9806\u756a\u3068\u3057\u3066<\/p>\n<ul>\n<li>1000 \u30df\u30ea\u79d2\u5f85\u3064<\/li>\n<li>\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u95a2\u6570\u3092\u5b9f\u884c<\/li>\n<\/ul>\n<p>\u306e\u9806\u304c\u5b88\u3089\u308c\u3066\u3044\u307e\u3059\u306d\uff01<\/p>\n<p>\u3059\u306a\u308f\u3061\u3001\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u95a2\u6570\u3068\u306f JavaScript \u306e\u95a2\u6570\u304c\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u3042\u308a\u3001<br \/>\n\u5909\u6570\u306b\u4ee3\u5165\u3067\u304d\u308b\u3068\u3044\u3046\u7279\u6027\u3092\u751f\u304b\u3057\u305f\u66f8\u304d\u65b9\u3060\u3063\u305f\u3001\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u306d\uff01<\/p>\n<p>\u5b9f\u969b\u306b\u7406\u89e3\u3057\u3066\u3057\u307e\u3048\u3070\u306a\u3093\u3066\u3053\u3068\u306a\u3044\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u95a2\u6570\u3067\u3059\u306e\u3067<br \/>\n\u7686\u3055\u3093\u3082\u662f\u975e\u4f7f\u3063\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u306d\uff01<\/p>\n<h1>\u30aa\u30de\u30b1\uff1a\u95a2\u6570\u3092\u8fd4\u3059\u95a2\u6570<\/h1>\n<p>\u3061\u306a\u307f\u306b\u3001\u95a2\u6570\u304c\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u3042\u308b\u3068\u3044\u3046\u3053\u3068\u306f\u3001\u5f53\u7136\u95a2\u6570\u306e\u8fd4\u308a\u5024\u3092\u95a2\u6570\u306b\u3059\u308b\u3053\u3068\u3060\u3063\u3066 OK \u3067\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nvar exec = function () {\n  console.log(&amp;#039;\u5b9f\u884c\uff01&amp;#039;);\n}\n<\/pre>\n<p>\u3053\u3093\u306a\u611f\u3058\u3067\u4f55\u304b\u3057\u3089\u3092\u5b9f\u884c\u3059\u308b\u95a2\u6570\u304c\u3042\u3063\u305f\u3068\u3057\u3066\u3001<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nvar logger = function(fn) {\n  return function () {\n    console.log(&amp;#039;\u95a2\u6570\u5b9f\u884c\u958b\u59cb&amp;#039;);\n    return fn\n  }\n}\n<\/pre>\n<p>\u3053\u3093\u306a\u98a8\u306b\u3059\u308b\u3068\u2026<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nlogger(exec)()\n<\/pre>\n<p>\u3068\u3059\u308b\u3053\u3068\u3067<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n(function(fn) {\n  return function () {\n    console.log(&amp;#039;\u95a2\u6570\u5b9f\u884c\u958b\u59cb&amp;#039;);\n    return fn\n  }\n})(exec)()\n<\/pre>\n<p>\u4e00\u3064\u76ee\u306e\u95a2\u6570\u304c\u5b9f\u884c\u3055\u308c\u3066<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nfunction () {\n  console.log(&amp;#039;\u95a2\u6570\u5b9f\u884c\u958b\u59cb&amp;#039;);\n  return exec\n}\n<\/pre>\n<p>\u304c\u8fd4\u3063\u3066\u304f\u308b\u3068<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n(function () {\n  console.log(&amp;#039;\u95a2\u6570\u5b9f\u884c\u958b\u59cb&amp;#039;);\n  return exec\n})()\n<\/pre>\n<p>\u306b\u306a\u3063\u3066\u3001\u3053\u308c\u3092\u5b9f\u884c\u3059\u308b\u3068\u6700\u7d42\u7d50\u679c\u306f<\/p>\n<ul>\n<li>\u95a2\u6570\u5b9f\u884c\u958b\u59cb<\/li>\n<li>\u5b9f\u884c\uff01<\/li>\n<\/ul>\n<p>\u3068\u51fa\u529b\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u306f\u3044\u308f\u3086\u308b\u30c7\u30b3\u30ec\u30fc\u30bf\u30fc\u3067\u3059\u306d\uff01<\/p>\n<p>\u3053\u3093\u306a\u611f\u3058\u3067\u3001\u95a2\u6570\u3092\u8fd4\u5374\u3055\u305b\u308b\u3053\u3068\u3067<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nfu()()\n<\/pre>\n<p>\u307f\u305f\u3044\u306a\u3001\u304b\u3063\u3053\u304c\u8907\u6570\u3064\u306a\u304c\u3063\u305f\u5f62\u304c\u767a\u751f\u3059\u308b\u3053\u3068\u3082\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u3067\u3059\u304c\u3001\u7d50\u5c40\u306f\u5168\u3066\u4eca\u56de\u89e3\u8aac\u3057\u305f\u30eb\u30fc\u30eb\u306b\u5f93\u3063\u3066\u3044\u308b\u3060\u3051\u306a\u306e\u3067\u3001<br \/>\n\u843d\u3061\u7740\u3044\u3066\u307f\u308c\u3070\u7406\u89e3\u3067\u304d\u308b\u3082\u306e\u306b\u306a\u3063\u3066\u3044\u307e\u3059\uff01<\/p>\n<p>JavaScript \u306f\u6163\u308c\u308b\u3068\u67d4\u8edf\u306b\u66f8\u3051\u308b\u8a00\u8a9e\u306a\u306e\u3067\u3001\u7686\u3055\u3093\u3082\u697d\u3057\u3093\u3067\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3057\u3066\u304f\u3060\u3055\u3044\u306d\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u56de\u306f\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u95a2\u6570\u306e\u304a\u8a71\u3067\u3059 \u3053\u3093\u306b\u3061\u306f\u3001\u6c5f\u5d5c\u3067\u3059\u3002 JavaScript \u66f8\u3044\u3066\u307e\u3059\u304b\uff01 \u66f8\u3044\u3066\u306a\u3044\u3067\u3059\u304b\uff1f JavaScript \u306f\u82e5\u5e72\u3001 \u4ed6\u306e\u8a00\u8a9e\u3068\u6bd4\u3079\u3066\u3068\u3063\u3064\u304d\u306b\u304f\u3044\u90e8\u5206\u304c\u3042\u3063\u305f\u308a\u3059\u308b\u8a00\u8a9e\u3060\u3068\u601d\u308f\u308c\u3066\u3044\u308b\u3088\u3046 [&hellip;]<\/p>\n","protected":false},"author":15,"featured_media":10502,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[10],"tags":[45],"class_list":["post-10455","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tech","tag-javascript"],"jetpack_featured_media_url":"https:\/\/www.agent-grow.com\/self20percent\/wp-content\/uploads\/2018\/10\/850c7612116999490846136e772ab7fd-2.png","jetpack_shortlink":"https:\/\/wp.me\/p7Bq4F-2ID","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/posts\/10455","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/comments?post=10455"}],"version-history":[{"count":0,"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/posts\/10455\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/media\/10502"}],"wp:attachment":[{"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/media?parent=10455"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/categories?post=10455"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.agent-grow.com\/self20percent\/wp-json\/wp\/v2\/tags?post=10455"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}