{"id":289,"date":"2018-02-25T21:28:00","date_gmt":"2018-02-25T12:28:00","guid":{"rendered":"http:\/\/attacktube.com\/?p=289"},"modified":"2023-09-12T20:01:22","modified_gmt":"2023-09-12T11:01:22","slug":"javascript-the-good-parts-%e8%a6%9a%e6%9b%b8-invocation-%e9%96%a2%e6%95%b0%e3%81%ae%e5%91%bc%e5%87%ba%e3%81%97","status":"publish","type":"post","link":"https:\/\/attacktube.com\/?p=289","title":{"rendered":"JavaScript The Good Parts \u899a\u66f8 \u95a2\u6570\u306e\u547c\u51fa\u3057"},"content":{"rendered":"\n<p>\u540d\u8457<a href=\"https:\/\/hb.afl.rakuten.co.jp\/ichiba\/298338d3.714ded4a.298338d4.abf99259\/?pc=https%3A%2F%2Fitem.rakuten.co.jp%2Fbook%2F5940391%2F&amp;link_type=text&amp;ut=eyJwYWdlIjoiaXRlbSIsInR5cGUiOiJ0ZXh0Iiwic2l6ZSI6IjI0MHgyNDAiLCJuYW0iOjEsIm5hbXAiOiJyaWdodCIsImNvbSI6MSwiY29tcCI6ImRvd24iLCJwcmljZSI6MSwiYm9yIjoxLCJjb2wiOjEsImJidG4iOjEsInByb2QiOjAsImFtcCI6ZmFsc2V9\" target=\"_blank\" rel=\"nofollow sponsored noopener\" style=\"word-wrap:break-word;\">JavaScript\uff1athe\u3000good\u3000parts \u300c\u826f\u3044\u30d1\u30fc\u30c4\u300d\u306b\u3088\u308b\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9 [ \u30c0\u30b0\u30e9\u30b9\u30fb\u30af\u30ed\u30d5\u30a9\u30fc\u30c9 ]<\/a>\u899a\u66f8<br>\u79c1\u304c\u8cb7\u3063\u305f\u306e\u306f,2010\u5e7410\u670813\u65e5 \u521d\u7248\u7b2c6\u5237\u767a\u884c<\/p>\n\n\n\n<!--more-->\n\n\n\n<br>\n<script async=\"\" src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js?client=ca-pub-3461056110605997\" crossorigin=\"anonymous\"><\/script>\n<ins class=\"adsbygoogle\" style=\"display:block; text-align:center;\" data-ad-layout=\"in-article\" data-ad-format=\"fluid\" data-ad-client=\"ca-pub-3461056110605997\" data-ad-slot=\"3137443461\"><\/ins>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script>\n<br>\n\n\n\n<p>Invocation \u95a2\u6570\u306e\u547c\u51fa\u3057(P32)<br>There are four patterns of invocation in Javascript.<br>(Javascript\u306b\u304a\u3044\u3066,\u95a2\u6570\u306e\u547c\u51fa\u3057\u306f4\u30d1\u30bf\u30fc\u30f3\u3042\u308b)<br>The method invocation pattern (\u30e1\u30bd\u30c3\u30c9\u547c\u51fa\u3057\u30d1\u30bf\u30fc\u30f3)<br>The function invocation pattern (\u95a2\u6570\u547c\u51fa\u3057\u30d1\u30bf\u30fc\u30f3)<br>The constructor invocation pattern (\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u547c\u51fa\u3057\u30d1\u30bf\u30fc\u30f3)<br>The apply invocation pattern (apply\u547c\u51fa\u3057\u30d1\u30bf\u30fc\u30f3)<\/p>\n\n\n\n<p>The patterns differ in how the bonus parameter this is initialized.<br>(this\u3068\u3044\u3046\u8ffd\u52a0\u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u3069\u306e\u3088\u3046\u306b\u521d\u671f\u5316\u3055\u308c\u308b\u304b\u3068\u3044\u3046\u70b9\u3067\u9055\u3046)<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">\u7591\u554f<\/mark><br>\u4f55\u6545,\u95a2\u6570\u306e\u547c\u51fa\u3057\u306bcall\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3057\u305f\u30d1\u30bf\u30fc\u30f3\u304c\u542b\u307e\u308c\u306a\u3044\u306e\u3060\u308d\u3046\u304b\uff1f<br>P162\uff5e168\u306ejson_parse\u95a2\u6570\u306b\u306fcall\u30e1\u30bd\u30c3\u30c9\u4f7f\u3063\u3066\u3044\u308b\u304b\u3089\u3053\u306e\u672c\u306e\u51fa\u7248\u6642\u306b\u306fcall\u30e1\u30bd\u30c3\u30c9\u304c\u5b58\u5728\u3057\u3066\u308b\u306f\u305a\u3002\u672c\u66f8\u306bcall\u30e1\u30bd\u30c3\u30c9\u306e\u89e3\u8aac\u306f\u4e00\u5207\u306a\u3057\u3002call\u30e1\u30bd\u30c3\u30c9\u3092\u610f\u56f3\u7684\u306b\u5916\u3057\u305f\u306e\u304b\uff1f<br>call\u30e1\u30bd\u30c3\u30c9\u306e\u89e3\u8aac\u3092\u5916\u3057\u305f\u7406\u7531\u306f\u4f5c\u8005\u3057\u304b\u5206\u304b\u3089\u306a\u3044\u306a\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>apply\u30e1\u30bd\u30c3\u30c9\u3068call\u30e1\u30bd\u30c3\u30c9\u306f\u3001\u95a2\u6570\u547c\u3073\u51fa\u3057\u30d1\u30bf\u30fc\u30f3\u306b\u304a\u3044\u3066this\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u3092\u6307\u5b9a\u3059\u308b\u305f\u3081\u306e\u65b9\u6cd5\u3067\u3042\u308b\u305f\u3081\u3001apply\u547c\u3073\u51fa\u3057\u30d1\u30bf\u30fc\u30f3\u3068call\u547c\u3073\u51fa\u3057\u30d1\u30bf\u30fc\u30f3\u30672\u3064\u306b\u5206\u3051\u306a\u3044\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-orange-color\">Invocation \u95a2\u6570\u306e\u547c\u51fa\u3057(\u4fee\u6b63\u7248)<\/mark><br>The method invocation pattern (\u30e1\u30bd\u30c3\u30c9\u547c\u51fa\u3057\u30d1\u30bf\u30fc\u30f3):\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30e1\u30bd\u30c3\u30c9\u3068\u3057\u3066\u95a2\u6570\u304c\u547c\u3073\u51fa\u3055\u308c\u308b\u3002<br>The function invocation pattern (\u95a2\u6570\u547c\u51fa\u3057\u30d1\u30bf\u30fc\u30f3):\u95a2\u6570\u304c\u5358\u72ec\u3067\u547c\u3073\u51fa\u3055\u308c\u308b\u3002<br>The constructor invocation pattern (\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u547c\u51fa\u3057\u30d1\u30bf\u30fc\u30f3):new \u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u4f7f\u7528\u3057\u3066\u95a2\u6570\u304c\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3068\u3057\u3066\u547c\u3073\u51fa\u3055\u308c\u3001\u65b0\u3057\u3044\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u751f\u6210\u3055\u308c\u308b\u3002<br>The apply, call invocation pattern (apply, call\u547c\u3073\u51fa\u3057\u30d1\u30bf\u30fc\u30f3): apply \u30e1\u30bd\u30c3\u30c9\u307e\u305f\u306f call \u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3057\u3066\u95a2\u6570\u304c\u547c\u3073\u51fa\u3055\u308c\u3001this \u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u3068\u5f15\u6570\u304c\u6307\u5b9a\u3055\u308c\u308b\u3002<\/p>\n\n\n\n<pre><code>\nvar json_parse = function(){\n\/\/\u3053\u306e\u4e2d\u3067call\u30e1\u30bd\u30c3\u30c9\u304c\u4f7f\u7528\u3055\u308c\u3066\u3044\u308b\n}();\n<\/code><\/pre>\n\n\n\n<script type=\"text\/javascript\">\njQuery(function($){\n$(\".jp-video\").hide();\n});\n<\/script>\n","protected":false},"excerpt":{"rendered":"<p>\u540d\u8457JavaScript\uff1athe\u3000good\u3000parts \u300c\u826f\u3044\u30d1\u30fc\u30c4\u300d\u306b\u3088\u308b\u30d9\u30b9\u30c8\u30d7\u30e9\u30af\u30c6\u30a3\u30b9 [ \u30c0\u30b0\u30e9\u30b9\u30fb\u30af\u30ed\u30d5\u30a9\u30fc\u30c9 ]\u899a\u66f8\u79c1\u304c\u8cb7\u3063\u305f\u306e\u306f,2010\u5e7410\u670813\u65e5 \u521d\u7248\u7b2c6\u5237\u767a\u884c<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-289","post","type-post","status-publish","format-standard","hentry","category-javascript"],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/attacktube.com\/index.php?rest_route=\/wp\/v2\/posts\/289","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/attacktube.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/attacktube.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/attacktube.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/attacktube.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=289"}],"version-history":[{"count":12,"href":"https:\/\/attacktube.com\/index.php?rest_route=\/wp\/v2\/posts\/289\/revisions"}],"predecessor-version":[{"id":4586,"href":"https:\/\/attacktube.com\/index.php?rest_route=\/wp\/v2\/posts\/289\/revisions\/4586"}],"wp:attachment":[{"href":"https:\/\/attacktube.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=289"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/attacktube.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=289"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/attacktube.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=289"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}