{"id":191887,"date":"2020-10-28T22:37:03","date_gmt":"2020-10-28T14:37:03","guid":{"rendered":"http:\/\/4563.org\/?p=191887"},"modified":"2020-10-28T22:37:03","modified_gmt":"2020-10-28T14:37:03","slug":"javascript-%e4%b8%ad%ef%bc%8c%e6%83%b3%e5%88%a0%e9%99%a4%e6%95%b0%e7%bb%84%e7%9a%84%e6%9c%80%e5%90%8e-n-%e9%a1%b9%ef%bc%88%e9%87%8d%e5%a4%8d%e5%be%88%e5%a4%9a%e6%ac%a1%ef%bc%89%ef%bc%8c%e6%9c%80","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=191887","title":{"rendered":"JavaScript \u4e2d\uff0c\u60f3\u5220\u9664\u6570\u7ec4\u7684\u6700\u540e N \u9879\uff08\u91cd\u590d\u5f88\u591a\u6b21\uff09\uff0c\u6700\u5feb\u7684\u65b9\u6cd5\u662f\u4ec0\u4e48\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  JavaScript \u4e2d\uff0c\u60f3\u5220\u9664\u6570\u7ec4\u7684\u6700\u540e N \u9879\uff08\u91cd\u590d\u5f88\u591a\u6b21\uff09\uff0c\u6700\u5feb\u7684\u65b9\u6cd5\u662f\u4ec0\u4e48\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : black11black <\/span>  <span><i><\/i> 3<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u5982\u9898\uff0c\u6c42 JS \u5927\u4f6c\u6307\u70b9\u3002<\/p>\n<p>\u76ee\u524d\u6709\u4e00\u4e2a\u5bf9\u8c61\uff0c\u4ee5\u4e0b\u8fd9\u79cd\u5f62\u5f0f\uff0c\u5171\u6709\u5927\u6982\u4e00\u5343\u4e2a\u5c5e\u6027\uff0c\u6bcf\u4e2a\u5c5e\u6027\u5bf9\u5e94\u4e00\u4e2a\u957f\u5ea6\u4e3a 1000 \u7684\u6570\u7ec4<\/p>\n<pre><code>let obj = {     a: [1,2,3,4...],     b: [9,10,11,...],     ... } <\/code><\/pre>\n<p>\u9700\u6c42\u662f\u5c06\u6240\u6709\u7684\u5c5e\u6027\uff0c\u90fd\u53ea\u622a\u53d6\u524d 500 \u4e2a\uff0c\u540e 500 \u4e2a\u4e0d\u8981\u4e86\u3002<\/p>\n<p>\u6700\u5feb\u7684\u65b9\u6cd5\u662f\u4ec0\u4e48\uff0c\u662f\u5e94\u8be5\u91cd\u590d pop 500 \u6b21\uff1f\u6216\u8005\u662f\u5e72\u8106\u65b0\u5efa\u4e00\u4e2a\u6570\u7ec4\u91cd\u65b0 push \u8fdb\u53bb\uff1f\u4e0d\u5e0c\u671b\u8fd9\u6b65\u64cd\u4f5c\u5403\u6027\u80fd\u3002<\/p>\n<p>\u8c22\u8c22\u5927\u5bb6<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>8<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4131435\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : newbieRenew <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             pop 500 \u6b21\u5e72\u561b\uff1f\u76f4\u63a5 length=500 \u4e0d\u5c31\u884c\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4131436\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Cbdy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @newbieRenew \u4e00\u6b63\u89e3                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4131437\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : lichdkimba <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             slice \u65b9\u6cd5\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4131438\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : christin <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @newbieRenew 666                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4131439\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : 66beta <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5c31\u4e0d\u80fd\u67e5\u4e00\u4e0b mdn \u4e0a array \u7684\u6587\u6863\u5417\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4131440\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : tiglapiles <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             function cut500(obj) {<br \/> const result = {}<br \/> for (const i in obj) {<br \/> result[i] = obj[i].slice(0,500)<br \/> }<br \/> return result<br \/>}                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4131441\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : yaphets666 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             slice \u5c31\u884c \u4f46\u662f slice \u662f\u521b\u5efa\u4e86\u4e00\u4e2a\u65b0\u7684\u6570\u7ec4 \u8fd9\u4e2a\u6027\u80fd\u4e0d\u77e5\u9053\u6bd4\u76f4\u63a5 length=500 \u5dee\u8fd8\u662f\u600e\u4e48\u6837                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4131442\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : yaphets666 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6d4b\u8bd5\u4e86\u4e00\u4e0b \u4e00\u5343\u4e07\u957f\u5ea6\u7684\u6570\u7ec4,\u5982\u679c\u53ea\u622a\u53d6\u524d 500 \u7684\u8bdd.slice \u65b9\u6cd5\u548c\u76f4\u63a5 length=500 \u90fd\u5728 1ms \u5185. \u622a\u53d6\u7684\u8d8a\u591a,\u6bd4\u5982\u524d 500 \u4e07\u4e2a\u5143\u7d20.length \u7684\u4f18\u52bf\u8d8a\u5927.                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>JavaScript \u4e2d\uff0c\u60f3\u5220\u9664\u6570&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/191887"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=191887"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/191887\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=191887"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=191887"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=191887"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}