{"id":3332,"date":"2024-11-10T09:26:39","date_gmt":"2024-11-10T01:26:39","guid":{"rendered":"https:\/\/fwq.ai\/blog\/3332\/"},"modified":"2024-11-10T09:26:39","modified_gmt":"2024-11-10T01:26:39","slug":"js%e5%a6%82%e4%bd%95%e9%99%a4%e6%b3%95%e5%8f%96%e6%95%b4","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/3332\/","title":{"rendered":"js\u5982\u4f55\u9664\u6cd5\u53d6\u6574"},"content":{"rendered":"<blockquote><p>\n  javascript \u4e2d\u8fdb\u884c\u9664\u6cd5\u53d6\u6574\u4f7f\u7528 math.floor() \u51fd\u6570\uff0c\u5b83\u8fd4\u56de\u7ed9\u5b9a\u6570\u5b57\u9664\u4ee5\u53e6\u4e00\u6570\u5b57\u540e\u7684\u6700\u5927\u6574\u6570\u3002\u8bed\u6cd5\uff1amath.floor(number)\u3002\u8be5\u51fd\u6570\u9002\u7528\u4e8e\u6570\u5b57\u53c2\u6570\uff0c\u8fd4\u56de\u6574\u6570\u7ed3\u679c\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202411\/08\/2024110809551026523.jpg\" class=\"aligncenter\" title=\"js\u5982\u4f55\u9664\u6cd5\u53d6\u6574\u63d2\u56fe\" alt=\"js\u5982\u4f55\u9664\u6cd5\u53d6\u6574\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5728 JavaScript \u4e2d\u8fdb\u884c\u9664\u6cd5\u53d6\u6574<\/strong><\/p>\n<p>\u5728 JavaScript \u4e2d\uff0c\u9664\u6cd5\u53d6\u6574\u662f\u901a\u8fc7\u4f7f\u7528 JavaScript \u5185\u7f6e\u51fd\u6570 Math.floor() \u6765\u5b9e\u73b0\u7684\u3002\u8be5\u51fd\u6570\u4f1a\u8fd4\u56de\u4e00\u4e2a\u6570\u5b57\uff0c\u8be5\u6570\u5b57\u662f\u7ed9\u5b9a\u6570\u5b57\u9664\u4ee5\u53e6\u4e00\u4e2a\u6570\u5b57\u540e\u7684\u6700\u5927\u6574\u6570\u3002<\/p>\n<p><strong>\u8bed\u6cd5\uff1a<\/strong><\/p>\n<pre>Math.floor(number)<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p><strong>\u53c2\u6570\uff1a<\/strong><\/p>\n<ul>\n<li>number\uff1a\u8981\u8fdb\u884c\u9664\u6cd5\u53d6\u6574\u7684\u6570\u5b57\u3002<\/li>\n<\/ul>\n<p><strong>\u8fd4\u56de\uff1a<\/strong><\/p>\n<ul>\n<li>\u4e00\u4e2a\u6574\u6570\uff0c\u662f\u7ed9\u5b9a\u6570\u5b57\u9664\u4ee5\u53e6\u4e00\u4e2a\u6570\u5b57\u540e\u7684\u6700\u5927\u6574\u6570\u3002<\/li>\n<\/ul>\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n<pre>const result = Math.floor(10 \/ 3); \/\/ 3<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u9664\u6cd5\u53d6\u6574\u7684\u7ed3\u679c\u662f 3\uff0c\u56e0\u4e3a 10 \u9664\u4ee5 3 \u7684\u6700\u5927\u6574\u6570\u662f 3\u3002<\/p>\n<p><strong>\u5176\u4ed6\u6ce8\u610f\u4e8b\u9879\uff1a<\/strong><\/p>\n<ul>\n<li>\u5982\u679c\u7ed9\u5b9a\u7684\u6570\u5b57\u662f\u8d1f\u6570\uff0cMath.floor() \u51fd\u6570\u4f1a\u8fd4\u56de\u7ed9\u5b9a\u6570\u5b57\u9664\u4ee5\u53e6\u4e00\u4e2a\u6570\u5b57\u540e\u7684\u6700\u5c0f\u6574\u6570\u3002<\/li>\n<li>\u5982\u679c\u7ed9\u5b9a\u7684\u6570\u5b57\u4e0d\u662f\u4e00\u4e2a\u6570\u5b57\uff0cMath.floor() \u51fd\u6570\u4f1a\u8fd4\u56de NaN\uff08\u975e\u6570\u5b57\uff09\u3002<\/li>\n<\/ul>\n<p><strong>\u5e94\u7528\uff1a<\/strong><\/p>\n<p>\u9664\u6cd5\u53d6\u6574\u5728 JavaScript \u4e2d\u6709\u8bb8\u591a\u5e94\u7528\uff0c\u4f8b\u5982\uff1a<\/p>\n<ul>\n<li>\u8ba1\u7b97\u6570\u7ec4\u7684\u957f\u5ea6<\/li>\n<li>\u521b\u5efa\u4e00\u4e2a\u6307\u5b9a\u957f\u5ea6\u7684\u6570\u7ec4<\/li>\n<li>\u820d\u5165\u6570\u5b57<\/li>\n<li>\u5c06\u6570\u5b57\u8f6c\u6362\u4e3a\u6574\u6570<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662fjs\u5982\u4f55\u9664\u6cd5\u53d6\u6574\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>javascript \u4e2d\u8fdb\u884c\u9664\u6cd5\u53d6\u6574\u4f7f\u7528 math.floor() \u51fd\u6570\uff0c\u5b83\u8fd4\u56de\u7ed9\u5b9a\u6570\u5b57\u9664\u4ee5\u53e6\u4e00\u6570\u5b57\u540e\u7684\u6700\u5927\u6574\u6570\u3002\u8bed\u6cd5\uff1amath.floor(number)\u3002\u8be5\u51fd\u6570\u9002\u7528\u4e8e\u6570\u5b57\u53c2\u6570\uff0c\u8fd4\u56de\u6574\u6570\u7ed3\u679c\u3002 \u5982\u4f55\u5728 JavaScript \u4e2d\u8fdb\u884c\u9664\u6cd5\u53d6\u6574 \u5728 JavaScript \u4e2d\uff0c\u9664\u6cd5\u53d6\u6574\u662f\u901a\u8fc7\u4f7f\u7528 JavaScript \u5185\u7f6e\u51fd\u6570 Math.floor() \u6765\u5b9e\u73b0\u7684\u3002\u8be5\u51fd\u6570\u4f1a\u8fd4\u56de\u4e00\u4e2a\u6570\u5b57\uff0c\u8be5\u6570\u5b57\u662f\u7ed9\u5b9a\u6570\u5b57\u9664\u4ee5\u53e6\u4e00\u4e2a\u6570\u5b57\u540e\u7684\u6700\u5927\u6574\u6570\u3002 \u8bed\u6cd5\uff1a Math.floor(number) \u767b\u5f55\u540e\u590d\u5236 \u53c2\u6570\uff1a number\uff1a\u8981\u8fdb\u884c\u9664\u6cd5\u53d6\u6574\u7684\u6570\u5b57\u3002 \u8fd4\u56de\uff1a \u4e00\u4e2a\u6574\u6570\uff0c\u662f\u7ed9\u5b9a\u6570\u5b57\u9664\u4ee5\u53e6\u4e00\u4e2a\u6570\u5b57\u540e\u7684\u6700\u5927\u6574\u6570\u3002 \u793a\u4f8b\uff1a const result = Math.floor(10 \/ 3); \/\/ 3 \u767b\u5f55\u540e\u590d\u5236 \u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u9664\u6cd5\u53d6\u6574\u7684\u7ed3\u679c\u662f 3\uff0c\u56e0\u4e3a 10 \u9664\u4ee5 3 \u7684\u6700\u5927\u6574\u6570\u662f 3\u3002 \u5176\u4ed6\u6ce8\u610f\u4e8b\u9879\uff1a \u5982\u679c\u7ed9\u5b9a\u7684\u6570\u5b57\u662f\u8d1f\u6570\uff0cMath.floor() \u51fd\u6570\u4f1a\u8fd4\u56de\u7ed9\u5b9a\u6570\u5b57\u9664\u4ee5\u53e6\u4e00\u4e2a\u6570\u5b57\u540e\u7684\u6700\u5c0f\u6574\u6570\u3002 \u5982\u679c\u7ed9\u5b9a\u7684\u6570\u5b57\u4e0d\u662f\u4e00\u4e2a\u6570\u5b57\uff0cMath.floor() \u51fd\u6570\u4f1a\u8fd4\u56de NaN\uff08\u975e\u6570\u5b57\uff09\u3002 \u5e94\u7528\uff1a \u9664\u6cd5\u53d6\u6574\u5728 JavaScript \u4e2d\u6709\u8bb8\u591a\u5e94\u7528\uff0c\u4f8b\u5982\uff1a \u8ba1\u7b97\u6570\u7ec4\u7684\u957f\u5ea6 \u521b\u5efa\u4e00\u4e2a\u6307\u5b9a\u957f\u5ea6\u7684\u6570\u7ec4 \u820d\u5165\u6570\u5b57 \u5c06\u6570\u5b57\u8f6c\u6362\u4e3a\u6574\u6570 \u4ee5\u4e0a\u5c31\u662fjs\u5982\u4f55\u9664\u6cd5\u53d6\u6574\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/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-3332","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/3332","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=3332"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/3332\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=3332"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=3332"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=3332"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}