{"id":172343,"date":"2024-05-08T17:48:23","date_gmt":"2024-05-08T09:48:23","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/172343.html"},"modified":"2024-05-08T17:48:29","modified_gmt":"2024-05-08T09:48:29","slug":"%ef%bc%bbjavascript%ef%bc%bd%e4%b8%ba%e4%bb%80%e4%b9%88%e4%b8%8d%e8%83%bd%e8%b0%83%e7%94%a8%e5%87%bd%e6%95%b0%e5%86%85%e7%9a%84%e5%87%bd%e6%95%b0","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/172343.html","title":{"rendered":"\uff3bJavaScript\uff3d\u4e3a\u4ec0\u4e48\u4e0d\u80fd\u8c03\u7528\u51fd\u6570\u5185\u7684\u51fd\u6570"},"content":{"rendered":"<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/27043848\/529c865a-e564-4531-90fc-8facf0cc4e03.webp\" alt=\"\uff3bJavaScript\uff3d\u4e3a\u4ec0\u4e48\u4e0d\u80fd\u8c03\u7528\u51fd\u6570\u5185\u7684\u51fd\u6570\" \/><\/p>\n<p><p><strong>JavaScript\u4e2d\u4e0d\u80fd\u8c03\u7528\u51fd\u6570\u5185\u7684\u51fd\u6570\u7684\u4e3b\u8981\u539f\u56e0\u662f\u4f5c\u7528\u57df\u9650\u5236<\/strong>\u3002\u5728JavaScript\u4e2d\uff0c\u6bcf\u4e2a\u51fd\u6570\u90fd\u6709\u81ea\u5df1\u7684\u4f5c\u7528\u57df\uff0c\u5176\u5185\u90e8\u5b9a\u4e49\u7684\u51fd\u6570\uff08\u5185\u90e8\u51fd\u6570\uff09\u53ea\u80fd\u5728\u8be5\u51fd\u6570\u5185\u88ab\u8c03\u7528\u3002\u8fd9\u79cd\u8bbe\u8ba1\u4f7f\u5f97\u5185\u90e8\u51fd\u6570\u4e0d\u4f1a\u4e0e\u5176\u4ed6\u4f5c\u7528\u57df\u4e2d\u7684\u53d8\u91cf\u6216\u51fd\u6570\u53d1\u751f\u547d\u540d\u51b2\u7a81\u3001\u4fdd\u6301\u4e86\u4ee3\u7801\u7684\u6a21\u5757\u6027\u548c\u5c01\u88c5\u6027\u3002\u8fd9\u79cd\u73b0\u8c61\u79f0\u4e3a\u8bcd\u6cd5\u4f5c\u7528\u57df\u6216\u9759\u6001\u4f5c\u7528\u57df\uff0c\u610f\u5473\u7740\u51fd\u6570\u7684\u4f5c\u7528\u57df\u5728\u51fd\u6570\u5b9a\u4e49\u65f6\u5c31\u5df2\u786e\u5b9a\uff0c\u800c\u4e0d\u662f\u5728\u6267\u884c\u65f6\u3002<\/p>\n<\/p>\n<p><p>\u4f8b\u5982\uff0c\u5f53\u6211\u4eec\u5b9a\u4e49\u4e86\u4e00\u4e2a\u51fd\u6570A\uff0c\u5728\u51fd\u6570A\u5185\u90e8\u53c8\u5b9a\u4e49\u4e86\u4e00\u4e2a\u51fd\u6570B\uff0c\u51fd\u6570B\u5c31\u662f\u4e00\u4e2a\u5185\u90e8\u51fd\u6570\uff0c\u5b83\u53ea\u80fd\u5728\u51fd\u6570A\u5185\u90e8\u88ab\u8bbf\u95ee\u548c\u8c03\u7528\u3002\u5982\u679c\u6211\u4eec\u8bd5\u56fe\u5728\u51fd\u6570A\u7684\u5916\u90e8\u8c03\u7528\u51fd\u6570B\uff0c\u5c06\u4f1a\u9047\u5230\u4e00\u4e2a\u5f15\u7528\u9519\u8bef\uff0c\u56e0\u4e3a\u51fd\u6570B\u5728\u8be5\u4f5c\u7528\u57df\u4e2d\u6ca1\u6709\u88ab\u5b9a\u4e49\u3002<\/p>\n<\/p>\n<p><p>\u8bcd\u6cd5\u4f5c\u7528\u57df\u4e2d\uff0c\u5185\u90e8\u51fd\u6570\u4f1a\u4fdd\u7559\u5bf9\u5305\u542b\uff08\u5916\u90e8\uff09\u51fd\u6570\u4f5c\u7528\u57df\u7684\u5f15\u7528\uff0c\u8fd9\u662f\u6211\u4eec\u79f0\u4e4b\u4e3a\u95ed\u5305\u7684\u6982\u5ff5\u3002\u5c3d\u7ba1\u5982\u6b64\uff0c\u8fd9\u5e76\u4e0d\u610f\u5473\u7740\u6211\u4eec\u53ef\u4ee5\u4ece\u5916\u90e8\u76f4\u63a5\u8c03\u7528\u5185\u90e8\u51fd\u6570\uff0c\u800c\u662f\u53d8\u76f8\u5730\u901a\u8fc7\u8fd4\u56de\u5185\u90e8\u51fd\u6570\u6216\u5c06\u5176\u5b58\u50a8\u5728\u53ef\u8bbf\u95ee\u7684\u53d8\u91cf\u4e2d\u6765\u5b9e\u73b0\u95f4\u63a5\u8c03\u7528\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u4f5c\u7528\u57df\u548c\u4f5c\u7528\u57df\u94fe<\/h3>\n<\/p>\n<p><p>\u4f5c\u7528\u57df\u548c\u4f5c\u7528\u57df\u94fe\u662f\u7406\u89e3\u51fd\u6570\u5185\u90e8\u51fd\u6570\u4e0d\u53ef\u8c03\u7528\u7684\u57fa\u7840\u3002\u4f5c\u7528\u57df\uff08Scope\uff09\u5b9a\u4e49\u4e86\u53d8\u91cf\u4e0e\u51fd\u6570\u7684\u53ef\u8bbf\u95ee\u6027\u3002\u5728JavaScript\u4e2d\uff0c\u4f5c\u7528\u57df\u89c4\u5b9a\u4e86\u4ee3\u7801\u5757\u5185\u58f0\u660e\u7684\u53d8\u91cf\u548c\u51fd\u6570\u7684\u53ef\u89c1\u6027\u548c\u751f\u547d\u5468\u671f\u3002\u8fd9\u4e9b\u4f5c\u7528\u57df\u53ef\u5206\u4e3a\u5168\u5c40\u4f5c\u7528\u57df\u3001\u51fd\u6570\u4f5c\u7528\u57df\u548c\u5757\u7ea7\u4f5c\u7528\u57df\uff08ES6\u5f15\u5165\u7684let\u548cconst\u7684\u7279\u6027\uff09\u3002<\/p>\n<\/p>\n<p><p>\u6bcf\u5f53\u4e00\u4e2a\u51fd\u6570\u88ab\u521b\u5efa\uff0c\u5b83\u5c31\u81ea\u52a8\u53d6\u5f97\u6240\u5728\u7684\u73af\u5883\u7684\u4f5c\u7528\u57df\u94fe\u3002<strong>\u4f5c\u7528\u57df\u94fe<\/strong>\u662f\u4e00\u4e2a\u5305\u542b\u8be5\u51fd\u6570\u4f5c\u7528\u57df\u548c\u6240\u6709\u7236\u7ea7\u6267\u884c\u73af\u5883\u4f5c\u7528\u57df\u7684\u5217\u8868\u3002\u5f53\u51fd\u6570\u6267\u884c\u65f6\uff0c\u5b83\u4f1a\u6309\u7167\u8fd9\u4e2a\u5217\u8868\u8bbf\u95ee\u53d8\u91cf\u548c\u5176\u4ed6\u51fd\u6570\u3002<\/p>\n<\/p>\n<p><p><strong>\u51fd\u6570\u5185\u7684\u51fd\u6570<\/strong>\u56e0\u6b64\u4f1a\u5f62\u6210\u4e00\u4e2a\u4f5c\u7528\u57df\u94fe\uff0c\u5916\u90e8\u4e0d\u80fd\u76f4\u63a5\u8bbf\u95ee\u5185\u90e8\u51fd\u6570\uff0c\u56e0\u4e3a\u5916\u90e8\u4e0d\u5728\u8fd9\u4e2a\u4f5c\u7528\u57df\u94fe\u4e0a\u3002\u4f46\u662f\u53cd\u8fc7\u6765\uff0c\u5185\u90e8\u51fd\u6570\u56e0\u4e3a\u4f5c\u7528\u57df\u94fe\u7684\u5173\u7cfb\u53ef\u4ee5\u8bbf\u95ee\u5916\u90e8\u51fd\u6570\u53ca\u5168\u5c40\u4f5c\u7528\u57df\u7684\u53d8\u91cf\u548c\u51fd\u6570\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001\u5185\u90e8\u51fd\u6570\u7684\u7279\u6027\u4e0e\u95ed\u5305<\/h3>\n<\/p>\n<p><p>\u5185\u90e8\u51fd\u6570\u548c\u95ed\u5305\u662f\u7406\u89e3\u8fd9\u4e00\u884c\u4e3a\u673a\u5236\u7684\u53e6\u4e00\u4e2a\u91cd\u8981\u6982\u5ff5\u3002\u5f53\u4e00\u4e2a\u51fd\u6570\u5185\u90e8\u518d\u5b9a\u4e49\u4e00\u4e2a\u51fd\u6570\u65f6\uff0c\u8fd9\u4e2a\u5185\u90e8\u7684\u51fd\u6570\u4f1a\u5bf9\u5305\u542b\u5b83\u7684\u5916\u90e8\u51fd\u6570\u7684\u53d8\u91cf\u5f62\u6210\u4e00\u4e2a\u95ed\u5305\u3002<\/p>\n<\/p>\n<p><p>\u95ed\u5305\uff08Closure\uff09\u4f7f\u5f97\u5185\u90e8\u51fd\u6570\u5373\u4f7f\u5728\u5305\u542b\u5b83\u7684\u5916\u90e8\u51fd\u6570\u6267\u884c\u5b8c\u6bd5\u540e\uff0c\u4f9d\u7136\u80fd\u591f\u8bbf\u95ee\u5916\u90e8\u51fd\u6570\u7684\u5c40\u90e8\u53d8\u91cf\u3002<strong>\u95ed\u5305\u4e0d\u4ec5\u4fdd\u62a4\u4e86\u8fd9\u4e9b\u53d8\u91cf\u4e0d\u88ab\u5916\u754c\u76f4\u63a5\u8bbf\u95ee\uff0c\u540c\u65f6\u4e5f\u5f15\u5165\u4e86\u5185\u5b58\u6301\u7eed\u5360\u7528\u7684\u95ee\u9898\uff0c\u56e0\u4e3a\u8fd9\u4e9b\u5c40\u90e8\u53d8\u91cf\u4e0d\u4f1a\u5728\u5916\u90e8\u51fd\u6570\u8c03\u7528\u7ed3\u675f\u540e\u88ab\u9500\u6bc1<\/strong>\u3002<\/p>\n<\/p>\n<p><p>\u867d\u7136\u95ed\u5305\u5141\u8bb8\u4e86\u5185\u90e8\u51fd\u6570\u8bbf\u95ee\u5916\u90e8\u51fd\u6570\u7684\u4f5c\u7528\u57df\uff0c\u4f46\u662f\u5b83\u5e76\u4e0d\u80fd\u6539\u53d8\u4f5c\u7528\u57df\u94fe\u7684\u65b9\u5411\uff1a\u53ea\u6709\u5185\u90e8\u53ef\u8bbf\u95ee\u5916\u90e8\uff0c\u800c\u5916\u90e8\u4e0d\u80fd\u8bbf\u95ee\u5185\u90e8\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u51fd\u6570\u63d0\u5347\u4e0e\u4f5c\u7528\u57df<\/h3>\n<\/p>\n<p><p>\u5728\u8be6\u7ec6\u8ba8\u8bba\u51fd\u6570\u7684\u4f5c\u7528\u57df\u65f6\uff0c\u6211\u4eec\u4e5f\u9700\u8981\u4e86\u89e3<strong>\u51fd\u6570\u58f0\u660e\u548c\u51fd\u6570\u8868\u8fbe\u5f0f\u7684\u533a\u522b<\/strong>\uff0c\u4ee5\u53ca\u8fd9\u79cd\u5dee\u5f02\u5982\u4f55\u5f71\u54cd\u51fd\u6570\u7684\u63d0\u5347\uff08Hoisting\uff09\u3002<\/p>\n<\/p>\n<p><p>\u5728JavaScript\u4e2d\uff0c\u51fd\u6570\u58f0\u660e\u4f1a\u88ab\u63d0\u5347\u5230\u5b83\u6240\u5728\u4f5c\u7528\u57df\u7684\u9876\u90e8\uff0c\u8fd9\u610f\u5473\u7740\u5373\u4f7f\u58f0\u660e\u5728\u540e\u9762\uff0c\u51fd\u6570\u4ecd\u65e7\u53ef\u4ee5\u5728\u4f5c\u7528\u57df\u7684\u4efb\u610f\u4f4d\u7f6e\u88ab\u8c03\u7528\u3002\u7136\u800c\uff0c\u5e76\u4e0d\u662f\u6240\u6709\u7684\u51fd\u6570\u5b9a\u4e49\u90fd\u4f1a\u88ab\u63d0\u5347\u3002\u5982\u679c\u4e00\u4e2a\u51fd\u6570\u662f\u4ee5\u51fd\u6570\u8868\u8fbe\u5f0f\u7684\u5f62\u5f0f\u5b9a\u4e49\u7684\uff0c\u4f8b\u5982\u8d4b\u503c\u7ed9\u4e00\u4e2a\u53d8\u91cf\uff0c\u90a3\u4e48\u5b83\u5c06\u4e0d\u4f1a\u88ab\u63d0\u5347\u3002<\/p>\n<\/p>\n<p><p>\u5f53\u4e00\u4e2a\u51fd\u6570\u5728\u53e6\u4e00\u4e2a\u51fd\u6570\u7684\u5185\u90e8\uff0c\u65e0\u8bba\u662f\u4ee5\u58f0\u660e\u7684\u5f62\u5f0f\u8fd8\u662f\u8868\u8fbe\u5f0f\u7684\u5f62\u5f0f\u5b9a\u4e49\uff0c\u5916\u90e8\u4f5c\u7528\u57df\u4f9d\u7136\u65e0\u6cd5\u76f4\u63a5\u8bbf\u95ee\u5230\u5b83\u3002\u56e0\u4e3a<strong>\u51fd\u6570\u63d0\u5347\u4ec5\u5728\u5f53\u524d\u4f5c\u7528\u57df\u5185\u6709\u6548<\/strong>\uff0c\u5b83\u5e76\u4e0d\u4f1a\u5f71\u54cd\u4f5c\u7528\u57df\u94fe\u7684\u5176\u4ed6\u90e8\u5206\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u5982\u4f55\u8bbf\u95ee\u51fd\u6570\u5185\u7684\u51fd\u6570<\/h3>\n<\/p>\n<p><p>\u5c3d\u7ba1\u5728\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u4e0d\u80fd\u76f4\u63a5\u4ece\u5916\u90e8\u8c03\u7528\u51fd\u6570\u5185\u90e8\u7684\u51fd\u6570\uff0c<strong>\u4f46\u662f\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u5176\u4ed6\u65b9\u5f0f\u95f4\u63a5\u5730\u505a\u5230\u8fd9\u4e00\u70b9<\/strong>\u3002\u8fd9\u4e3b\u8981\u901a\u8fc7\u4e24\u79cd\u65b9\u5f0f\u5b9e\u73b0\uff1a\u8fd4\u56de\u5185\u90e8\u51fd\u6570\u6216\u8005\u4f7f\u7528\u95ed\u5305\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u79cd\u5e38\u89c1\u7684\u505a\u6cd5\u662f\u5916\u90e8\u51fd\u6570\u8fd4\u56de\u5176\u5185\u90e8\u7684\u51fd\u6570\uff0c\u8fd9\u6837\u5916\u90e8\u4f5c\u7528\u57df\u5c31\u53ef\u4ee5\u83b7\u5f97\u4e00\u4e2a\u6307\u5411\u5185\u90e8\u51fd\u6570\u7684\u5f15\u7528\u3002\u901a\u8fc7\u8fd9\u4e2a\u5f15\u7528\uff0c\u53ef\u4ee5\u968f\u540e\u5728\u5916\u90e8\u4f5c\u7528\u57df\u4e2d\u8c03\u7528\u8fd9\u4e2a\u5185\u90e8\u51fd\u6570\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-javascript\">function outerFunction() {<\/p>\n<p>    function innerFunction() {<\/p>\n<p>        console.log(&#039;Hello from the inside!&#039;);<\/p>\n<p>    }<\/p>\n<p>    return innerFunction;<\/p>\n<p>}<\/p>\n<p>var accessibleFunction = outerFunction();<\/p>\n<p>accessibleFunction(); \/\/ Output: Hello from the inside!<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u53e6\u4e00\u79cd\u65b9\u6cd5\u662f\u5728\u5bf9\u8c61\u7684\u65b9\u6cd5\u4e2d\u5b9a\u4e49\u5185\u90e8\u51fd\u6570\uff0c\u5e76\u5c06\u5176\u4f5c\u4e3a\u8fd4\u56de\u503c\u3002\u8fd9\u6837\u4e00\u6765\uff0c\u5c3d\u7ba1\u51fd\u6570\u672c\u8eab\u662f\u5c40\u90e8\u7684\uff0c\u5916\u90e8\u4ee3\u7801\u4ecd\u7136\u53ef\u4ee5\u901a\u8fc7\u65b9\u6cd5\u8c03\u7528\u6765\u95f4\u63a5\u5730\u6267\u884c\u5b83\u3002\u4f8b\u5982\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-javascript\">function outerFunction() {<\/p>\n<p>    this.innerFunction = function () {<\/p>\n<p>        console.log(&#039;Hello from the inside!&#039;);<\/p>\n<p>    };<\/p>\n<p>}<\/p>\n<p>var obj = new outerFunction();<\/p>\n<p>obj.innerFunction(); \/\/ Output: Hello from the inside!<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u603b\u7684\u6765\u8bf4\uff0c\u867d\u7136JavaScript\u7684\u4f5c\u7528\u57df\u89c4\u5219\u9650\u5236\u4e86\u51fd\u6570\u5185\u90e8\u51fd\u6570\u7684\u8c03\u7528\uff0c\u6211\u4eec\u4ecd\u7136\u53ef\u4ee5\u901a\u8fc7\u8bf8\u5982<strong>\u8fd4\u56de\u51fd\u6570\u5f15\u7528\u3001\u4f7f\u7528\u95ed\u5305\u7ed3\u6784<\/strong>\u7b49\u6280\u672f\u624b\u6bb5\uff0c\u5b9e\u73b0\u4ece\u5916\u90e8\u4f5c\u7528\u57df\u8bbf\u95ee\u8fd9\u4e9b\u5185\u90e8\u51fd\u6570\u7684\u76ee\u7684\u3002\u8fd9\u4e9b\u6280\u5de7\u5728\u95ed\u5305\u3001\u6a21\u5757\u6a21\u5f0f\u3001\u7acb\u5373\u6267\u884c\u7684\u51fd\u6570\u8868\u8fbe\u5f0f\uff08IIFE\uff09\u7b49JavaScript\u9ad8\u7ea7\u5e94\u7528\u4e2d\u626e\u6f14\u7740\u5173\u952e\u89d2\u8272\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p><strong>\u4e3a\u4ec0\u4e48JavaScript\u4e2d\u65e0\u6cd5\u8c03\u7528\u51fd\u6570\u5185\u90e8\u7684\u51fd\u6570\uff1f<\/strong><\/p>\n<p>\u5728JavaScript\u4e2d\uff0c\u51fd\u6570\u5185\u90e8\u7684\u51fd\u6570\u88ab\u79f0\u4e3a\u5c40\u90e8\u51fd\u6570\u6216\u5185\u90e8\u51fd\u6570\u3002\u8fd9\u4e9b\u51fd\u6570\u53ea\u80fd\u5728\u5b9a\u4e49\u5b83\u4eec\u7684\u51fd\u6570\u5185\u90e8\u4f7f\u7528\uff0c\u5e76\u4e14\u65e0\u6cd5\u5728\u5916\u90e8\u76f4\u63a5\u8bbf\u95ee\u3002\u8fd9\u662f\u7531\u4e8eJavaScript\u7684\u4f5c\u7528\u57df\u9650\u5236\u6240\u5bfc\u81f4\u7684\u3002<\/p>\n<p><strong>\u4f5c\u7528\u57df\u662f\u4ec0\u4e48\uff1f<\/strong><\/p>\n<p>\u4f5c\u7528\u57df\u662f\u6307\u5728\u7a0b\u5e8f\u4e2d\u5b9a\u4e49\u53d8\u91cf\u7684\u533a\u57df\uff0c\u5b83\u51b3\u5b9a\u4e86\u53d8\u91cf\u7684\u53ef\u89c1\u6027\u548c\u751f\u547d\u5468\u671f\u3002\u5728JavaScript\u4e2d\uff0c\u6bcf\u4e2a\u51fd\u6570\u90fd\u6709\u81ea\u5df1\u7684\u4f5c\u7528\u57df\uff0c\u8fd9\u610f\u5473\u7740\u5728\u51fd\u6570\u5185\u90e8\u5b9a\u4e49\u7684\u53d8\u91cf\u548c\u51fd\u6570\u53ea\u80fd\u5728\u8be5\u51fd\u6570\u5185\u90e8\u8bbf\u95ee\u3002\u56e0\u6b64\uff0c\u5982\u679c\u5728\u4e00\u4e2a\u51fd\u6570\u5185\u90e8\u5b9a\u4e49\u4e86\u53e6\u4e00\u4e2a\u51fd\u6570\uff0c\u540e\u8005\u53ea\u80fd\u5728\u8be5\u51fd\u6570\u5185\u90e8\u8c03\u7528\u3002<\/p>\n<p><strong>\u6709\u6ca1\u6709\u529e\u6cd5\u5728JavaScript\u4e2d\u8c03\u7528\u51fd\u6570\u5185\u90e8\u7684\u51fd\u6570\uff1f<\/strong><\/p>\n<p>\u5c3d\u7ba1\u65e0\u6cd5\u76f4\u63a5\u8c03\u7528\u51fd\u6570\u5185\u90e8\u7684\u51fd\u6570\uff0c\u4f46\u53ef\u4ee5\u901a\u8fc7\u5176\u4ed6\u65b9\u5f0f\u95f4\u63a5\u5b9e\u73b0\u3002\u4e00\u79cd\u5e38\u89c1\u7684\u65b9\u6cd5\u662f\u5728\u51fd\u6570\u8fd4\u56de\u4e00\u4e2a\u5305\u542b\u5185\u90e8\u51fd\u6570\u7684\u5bf9\u8c61\uff0c\u7136\u540e\u5728\u5916\u90e8\u4f7f\u7528\u8be5\u5bf9\u8c61\u8c03\u7528\u5185\u90e8\u51fd\u6570\u3002\u53e6\u4e00\u79cd\u65b9\u6cd5\u662f\u4f7f\u7528\u95ed\u5305\uff0c\u901a\u8fc7\u8fd4\u56de\u4e00\u4e2a\u51fd\u6570\u6765\u95f4\u63a5\u8c03\u7528\u5185\u90e8\u51fd\u6570\u3002<\/p>\n<p>\u4e0d\u8fc7\uff0c\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u4f7f\u7528\u8fd9\u4e9b\u65b9\u6cd5\u8c03\u7528\u51fd\u6570\u5185\u90e8\u7684\u51fd\u6570\u53ef\u80fd\u4f1a\u5bfc\u81f4\u4f5c\u7528\u57df\u6df7\u4e71\u548c\u5185\u5b58\u6cc4\u6f0f\u7684\u95ee\u9898\u3002\u56e0\u6b64\uff0c\u5728\u7f16\u5199JavaScript\u4ee3\u7801\u65f6\uff0c\u5e94\u5c3d\u91cf\u907f\u514d\u5728\u51fd\u6570\u5185\u90e8\u5b9a\u4e49\u51fd\u6570\uff0c\u4ee5\u4fdd\u6301\u7a0b\u5e8f\u7684\u53ef\u8bfb\u6027\u548c\u53ef\u7ef4\u62a4\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"JavaScript\u4e2d\u4e0d\u80fd\u8c03\u7528\u51fd\u6570\u5185\u7684\u51fd\u6570\u7684\u4e3b\u8981\u539f\u56e0\u662f\u4f5c\u7528\u57df\u9650\u5236\u3002\u5728JavaScript\u4e2d\uff0c\u6bcf\u4e2a\u51fd\u6570\u90fd\u6709\u81ea\u5df1\u7684 [&hellip;]","protected":false},"author":3,"featured_media":172354,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/172343"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=172343"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/172343\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/172354"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=172343"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=172343"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=172343"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}