{"id":1130,"date":"2022-05-07T10:02:59","date_gmt":"2022-05-07T02:02:59","guid":{"rendered":"http:\/\/zhuxinyong.com\/?p=1130"},"modified":"2022-05-07T10:49:54","modified_gmt":"2022-05-07T02:49:54","slug":"parameter-he-argument-qu-bie-he-lian-xi","status":"publish","type":"post","link":"https:\/\/zhuxinyong.com\/?p=1130","title":{"rendered":"parameter \u548c argument \u533a\u522b\u548c\u8054\u7cfb"},"content":{"rendered":"<p><img decoding=\"async\" src=\"http:\/\/zhuxinyong.com\/wp-content\/uploads\/2022\/05\/\u9ed8\u8ba4\u6807\u9898_\u516c\u4f17\u53f7\u5c01\u9762\u9996\u56fe_2022-05-0710_49_07.png\" alt=\"\u9ed8\u8ba4\u6807\u9898_\u516c\u4f17\u53f7\u5c01\u9762\u9996\u56fe_2022-05-07+10_49_07\" \/><\/p>\n<p>\u4f30\u8ba1\u597d\u591a\u5c0f\u4f19\u4f34\u6ca1\u6709\u5bf9\u8fd9\u4e24\u4e2a\u540d\u5b57\u6709\u5f88\u660e\u786e\u7684\u533a\u5206\uff0c\u7f16\u7a0b\u7684\u65f6\u5019\u4f1a\u6df7\u7528\uff1a<\/p>\n<p>\u6709\u65f6\u5019\u8fd9\u6837\uff1a<\/p>\n<pre><code class=\"language-plain_text\">function Foo(args){\n    \/\/ ...\n}\n<\/code><\/pre>\n<p>\u6709\u65f6\u5019\u4e5f\u4f1a\u8fd9\u6837\uff1a<\/p>\n<pre><code class=\"language-plain_text\">function Foo(params){\n    \/\/ ...\n}\n<\/code><\/pre>\n<p>\u867d\u8bf4\u8fd9\u91cc\u7684\u540d\u5b57\u5199\u4ec0\u4e48\u90fd\u884c\uff0c\u4f46\u662f\u82e5\u5bf9\u8fd9\u4e24\u4e2a\u540d\u8bcd\u6709\u6df1\u523b\u7684\u8ba4\u8bc6\u5c31\u4e0d\u4f1a\u5728\u4e00\u4e2a\u9879\u76ee\u4e2d\u6df7\u7528\u3002\u4e00\u662f\u663e\u7684\u6742\u4e71\u3001\u4e0d\u7edf\u4e00\uff0c\u4e8c\u662f\u663e\u7684\u4e0d\u4e13\u4e1a\u3002<\/p>\n<p>\u90a3\u5b83\u4fe9\u6709\u5565\u533a\u522b\u548c\u8054\u7cfb\u5462\uff1f<\/p>\n<ol>\n<li><strong>parameter<\/strong> \u662f\u628a\u4f20\u9012\u7ed9\u51fd\u6570\u7684\u53c2\u6570\u547d\u540d\u7684\uff0c\u5b83\u628a argument \u5f15\u5165\u5230\u51fd\u6570\u3002<\/li>\n<li><strong>argument<\/strong> \u662f\u4f20\u9012\u7ed9\u51fd\u6570\u7684\u503c\uff08\u539f\u59cb\u7c7b\u578b\u7684\u503c\u548c\u5bf9\u8c61\u7c7b\u578b\u7684\u503c\uff09\u3002<\/li>\n<\/ol>\n<p>\u770b\u8fd9\u4e2a\u4f8b\u5b50\uff1a<\/p>\n<pre><code class=\"language-plain_text\">function example(parameter) {\n  console.log(parameter); \/\/ Output = foo\n}\n\nconst argument = 'foo';\n\nexample(argument);\n<\/code><\/pre>\n<p>\u770b\u5230\u4e86\u5427\uff0c<strong>parameter<\/strong> \u662f\u5f62\u53c2\u5bf9\u53c2\u6570\u547d\u540d\uff0c\u800c <strong>argument<\/strong> \u662f\u5b9e\u53c2\u4f20\u9012\u7ed9\u51fd\u6570\u7684\u5b9e\u9645\u53c2\u6570\u3002<\/p>\n<blockquote>\n<ul>\n<li>Function parameters are the names listed in the function&#8217;s definition.<\/li>\n<li>Function arguments are the real values passed to the function.<\/li>\n<li>Parameters are initialized to the values of the arguments supplied.<\/li>\n<\/ul>\n<\/blockquote>\n<p>\u53c2\u8003\uff1a<\/p>\n<ol>\n<li><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Glossary\/Parameter\" target=\"_blank\" rel=\"noopener\">https:\/\/developer.mozilla.org\/en-US\/docs\/Glossary\/Parameter<\/a><\/li>\n<li><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Glossary\/Argument\" target=\"_blank\" rel=\"noopener\">https:\/\/developer.mozilla.org\/en-US\/docs\/Glossary\/Argument<\/a><\/li>\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/Parameter_%28computer_programming%29#Parameters_and_arguments\" target=\"_blank\" rel=\"noopener\">https:\/\/en.wikipedia.org\/wiki\/Parameter_%28computer_programming%29#Parameters_and_arguments<\/a><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>\u4f30\u8ba1\u597d\u591a\u5c0f\u4f19\u4f34\u6ca1\u6709\u5bf9\u8fd9\u4e24\u4e2a\u540d\u5b57\u6709\u5f88\u660e\u786e\u7684\u533a\u5206\uff0c\u7f16\u7a0b\u7684\u65f6\u5019\u4f1a\u6df7\u7528\uff1a \u6709\u65f6\u5019\u8fd9\u6837\uff1a function F&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,20,3],"tags":[116,115],"class_list":["post-1130","post","type-post","status-publish","format-standard","hentry","category-all","category-frontend","category-tech","tag-argument","tag-parameter"],"_links":{"self":[{"href":"https:\/\/zhuxinyong.com\/index.php?rest_route=\/wp\/v2\/posts\/1130","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zhuxinyong.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zhuxinyong.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zhuxinyong.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zhuxinyong.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1130"}],"version-history":[{"count":2,"href":"https:\/\/zhuxinyong.com\/index.php?rest_route=\/wp\/v2\/posts\/1130\/revisions"}],"predecessor-version":[{"id":1133,"href":"https:\/\/zhuxinyong.com\/index.php?rest_route=\/wp\/v2\/posts\/1130\/revisions\/1133"}],"wp:attachment":[{"href":"https:\/\/zhuxinyong.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1130"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zhuxinyong.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1130"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zhuxinyong.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1130"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}