{"id":5757,"date":"2023-01-06T14:55:29","date_gmt":"2023-01-06T06:55:29","guid":{"rendered":"https:\/\/badgameshow.com\/steven\/?p=5757"},"modified":"2023-01-06T14:55:29","modified_gmt":"2023-01-06T06:55:29","slug":"%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8react-js%e6%b1%82%e5%8f%96reactlist%e4%b8%ad%e7%9a%84%e6%9c%80%e5%a4%a7%e5%80%bc-2","status":"publish","type":"post","link":"https:\/\/badgameshow.com\/steven\/react-js\/%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8react-js%e6%b1%82%e5%8f%96reactlist%e4%b8%ad%e7%9a%84%e6%9c%80%e5%a4%a7%e5%80%bc-2\/","title":{"rendered":"\u5982\u4f55\u4f7f\u7528React.JS\u6c42\u53d6ReactList\u4e2d\u7684\u6700\u5927\u503c"},"content":{"rendered":"<p><meta name=\"keywords\" content=\"React, React List, maxValue\"><\/p>\n<h1>\u4f7f\u7528 React.JS \u6c42\u51fa React List \u4e2d\u7684\u6700\u5927\u503c(maxValue)<\/h1>\n<p>React.JS \u662f\u4e00\u500b\u7528\u65bc\u69cb\u5efa\u7528\u6236\u754c\u9762\u7684 JavaScript \u5eab\uff0c\u5b83\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u5feb\u901f\u69cb\u5efa\u51fa\u9ad8\u54c1\u8cea\u7684\u7528\u6236\u754c\u9762\u3002\u5728 React.JS \u4e2d\uff0c\u958b\u767c\u8005\u53ef\u4ee5\u4f7f\u7528 React List \u4f86\u5132\u5b58\u4e00\u7cfb\u5217\u7684\u8cc7\u6599\uff0c\u800c\u6c42\u51fa React List \u4e2d\u7684\u6700\u5927\u503c(maxValue)\u4e5f\u662f\u4e00\u500b\u5e38\u898b\u7684\u4efb\u52d9\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u4f7f\u7528 React.JS \u4f86\u6c42\u51fa React List \u4e2d\u7684\u6700\u5927\u503c(maxValue)\u3002<\/p>\n<h2>\u4f7f\u7528 Math.max() \u6c42\u51fa React List \u4e2d\u7684\u6700\u5927\u503c<\/h2>\n<p>Math.max() \u662f JavaScript \u4e2d\u7684\u4e00\u500b\u5167\u7f6e\u51fd\u6578\uff0c\u5b83\u53ef\u4ee5\u7528\u4f86\u6c42\u51fa\u4e00\u7cfb\u5217\u6578\u5b57\u4e2d\u7684\u6700\u5927\u503c\u3002\u5728 React.JS \u4e2d\uff0c\u6211\u5011\u53ef\u4ee5\u4f7f\u7528 Math.max() \u4f86\u6c42\u51fa React List \u4e2d\u7684\u6700\u5927\u503c(maxValue)\uff0c\u793a\u4f8b\u4ee3\u78bc\u5982\u4e0b\uff1a<\/p>\n<pre class=\"brush: javascript\">\nconst list = [1, 2, 3, 4, 5];\nconst maxValue = Math.max(...list);\nconsole.log(maxValue); \/\/ 5\n<\/pre>\n<p>\u5728\u4e0a\u9762\u7684\u793a\u4f8b\u4ee3\u78bc\u4e2d\uff0c\u6211\u5011\u4f7f\u7528 Math.max() \u4f86\u6c42\u51fa React List \u4e2d\u7684\u6700\u5927\u503c(maxValue)\uff0c\u6700\u5f8c\u5f97\u5230\u7684\u7d50\u679c\u662f 5\u3002<\/p>\n<h2>\u4f7f\u7528 reduce() \u6c42\u51fa React List \u4e2d\u7684\u6700\u5927\u503c<\/h2>\n<p>\u9664\u4e86\u4f7f\u7528 Math.max() \u4e4b\u5916\uff0c\u6211\u5011\u9084\u53ef\u4ee5\u4f7f\u7528 reduce() \u4f86\u6c42\u51fa React List \u4e2d\u7684\u6700\u5927\u503c(maxValue)\uff0c\u793a\u4f8b\u4ee3\u78bc\u5982\u4e0b\uff1a<\/p>\n<pre class=\"brush: javascript\">\nconst list = [1, 2, 3, 4, 5];\nconst maxValue = list.reduce((acc, cur) => Math.max(acc, cur));\nconsole.log(maxValue); \/\/ 5\n<\/pre>\n<p>\u5728\u4e0a\u9762\u7684\u793a\u4f8b\u4ee3\u78bc\u4e2d\uff0c\u6211\u5011\u4f7f\u7528 reduce() \u4f86\u6c42\u51fa React List \u4e2d\u7684\u6700\u5927\u503c(maxValue)\uff0c\u6700\u5f8c\u5f97\u5230\u7684\u7d50\u679c\u662f 5\u3002<\/p>\n<h2>\u7e3d\u7d50<\/h2>\n<p>\u5728\u672c\u6587\u4e2d\uff0c\u6211\u5011\u4ecb\u7d39\u4e86\u5982\u4f55\u4f7f\u7528 React.JS \u4f86\u6c42\u51fa React List \u4e2d\u7684\u6700\u5927\u503c(maxValue)\uff0c\u53ef\u4ee5\u4f7f\u7528 Math.max() \u6216 reduce() \u4f86\u5be6\u73fe\u9019\u500b\u4efb\u52d9\u3002\u5e0c\u671b\u672c\u6587\u80fd\u5920\u5c0d\u4f60\u6709\u6240\u5e6b\u52a9\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6458\u8981\uff1a\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u4f7f\u7528React.JS\u6c42\u53d6ReactList\u4e2d\u7684\u6700\u5927\u503c\uff0c\u4e26\u63d0\u4f9b\u7c21\u55ae\u6613\u61c2\u7684\u7a0b\u5f0f\u78bc\u793a\u4f8b\uff0c\u8b93\u958b\u767c\u8005\u53ef\u4ee5\u5feb\u901f\u4e0a\u624b\uff0c\u66f4\u6709\u6548\u7387\u5730\u5b8c\u6210\u4efb\u52d9\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[184,183],"tags":[182,181],"class_list":["post-5757","post","type-post","status-publish","format-standard","hentry","category-react","category-react-js","tag-react","tag-react-js"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_shortlink":"https:\/\/wp.me\/pcFK27-1uR","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/5757","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/comments?post=5757"}],"version-history":[{"count":1,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/5757\/revisions"}],"predecessor-version":[{"id":5758,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/5757\/revisions\/5758"}],"wp:attachment":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/media?parent=5757"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/categories?post=5757"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/tags?post=5757"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}