{"id":3832,"date":"2024-11-10T09:58:21","date_gmt":"2024-11-10T01:58:21","guid":{"rendered":"https:\/\/fwq.ai\/blog\/3832\/"},"modified":"2024-11-10T09:58:21","modified_gmt":"2024-11-10T01:58:21","slug":"%e5%a6%82%e4%bd%95%e5%b0%86%e6%95%b0%e7%bb%84%e5%88%86%e5%89%b2%e6%88%90%e7%9b%b8%e9%82%bb%e4%b8%89%e5%85%83%e7%bb%84%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/3832\/","title":{"rendered":"\u5982\u4f55\u5c06\u6570\u7ec4\u5206\u5272\u6210\u76f8\u90bb\u4e09\u5143\u7ec4\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173114947595688.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u5c06\u6570\u7ec4\u5206\u5272\u6210\u76f8\u90bb\u4e09\u5143\u7ec4\uff1f\u63d2\u56fe\" alt=\"\u5982\u4f55\u5c06\u6570\u7ec4\u5206\u5272\u6210\u76f8\u90bb\u4e09\u5143\u7ec4\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5c06\u6570\u7ec4\u5206\u5272\u4e3a\u76f8\u90bb\u4e09\u5143\u7ec4<\/strong><\/p>\n<p>\u5bf9\u4e8e\u7ed9\u5b9a\u7684\u6570\u7ec4 [1, 2, 3, 4, 5, 6, 7, 8, 9]\uff0c\u8981\u5c06\u5176\u5206\u5272\u6210\u4e09\u4e2a\u6570\u7ec4 [1, 4, 7], [2, 5, 8], [3, 6, 9], \u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/p>\n<pre>\/\/ \u83b7\u53d6\u6570\u7ec4\u957f\u5ea6\nconst length = array.length;\n\n\/\/ \u521b\u5efa\u4e09\u4e2a\u65b0\u6570\u7ec4\nconst arr1 = [];\nconst arr2 = [];\nconst arr3 = [];\n\n\/\/ \u6309\u7ec4\u586b\u5145\u6570\u7ec4\nfor (let i = 0; i &lt; length; i += 3) {\n  arr1.push(array[i]);\n  arr2.push(array[i + 1]);\n  arr3.push(array[i + 2]);\n}<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p><strong>\u6ce8\u610f\uff1a<\/strong><\/p>\n<p>\u5982\u679c\u8f93\u5165\u7684\u6570\u7ec4\u957f\u5ea6\u4e0d\u662f 3 \u7684\u500d\u6570\uff0c\u8be5\u4ee3\u7801\u5c06\u65e0\u6cd5\u6b63\u5e38\u5de5\u4f5c\u3002\u8fd9\u5728\u95ee\u9898\u4e2d\u6ca1\u6709\u6307\u5b9a\uff0c\u56e0\u6b64\u6211\u4eec\u5047\u5b9a\u6570\u7ec4\u957f\u5ea6\u603b\u662f 3 \u7684\u500d\u6570\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u5c06\u6570\u7ec4\u5206\u5272\u6210\u76f8\u90bb\u4e09\u5143\u7ec4\uff1f\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5c06\u6570\u7ec4\u5206\u5272\u4e3a\u76f8\u90bb\u4e09\u5143\u7ec4 \u5bf9\u4e8e\u7ed9\u5b9a\u7684\u6570\u7ec4 [1, 2, 3, 4, 5, 6, 7, 8, 9]\uff0c\u8981\u5c06\u5176\u5206\u5272\u6210\u4e09\u4e2a\u6570\u7ec4 [1, 4, 7], [2, 5, 8], [3, 6, 9], \u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u6b65\u9aa4\uff1a \/\/ \u83b7\u53d6\u6570\u7ec4\u957f\u5ea6 const length = array.length; \/\/ \u521b\u5efa\u4e09\u4e2a\u65b0\u6570\u7ec4 const arr1 = []; const arr2 = []; const arr3 = []; \/\/ \u6309\u7ec4\u586b\u5145\u6570\u7ec4 for (let i = 0; i &lt; length; i += 3) { [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-3832","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/3832","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=3832"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/3832\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=3832"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=3832"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=3832"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}