{"id":3398,"date":"2024-11-10T13:40:37","date_gmt":"2024-11-10T05:40:37","guid":{"rendered":"https:\/\/fwq.ai\/blog\/3398\/"},"modified":"2024-11-10T13:40:37","modified_gmt":"2024-11-10T05:40:37","slug":"js%e5%a6%82%e4%bd%95%e6%ad%a3%e7%a1%ae%e7%9a%84%e5%8f%96%e7%99%be%e4%bd%8d%e6%95%b0","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/3398\/","title":{"rendered":"js\u5982\u4f55\u6b63\u786e\u7684\u53d6\u767e\u4f4d\u6570"},"content":{"rendered":"<blockquote><p>\n  \u5728 javascript \u4e2d\uff0c\u6b63\u786e\u53d6\u767e\u4f4d\u6570\u7684\u65b9\u6cd5\u662f\uff1a\u5c06\u6570\u5b57\u9664\u4ee5 100\u3002\u5bf9\u7ed3\u679c\u53d6\u6a21 100\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202411\/08\/2024110811304247678.jpg\" class=\"aligncenter\" title=\"js\u5982\u4f55\u6b63\u786e\u7684\u53d6\u767e\u4f4d\u6570\u63d2\u56fe\" alt=\"js\u5982\u4f55\u6b63\u786e\u7684\u53d6\u767e\u4f4d\u6570\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u6b63\u786e\u53d6\u767e\u4f4d\u6570<\/strong><\/p>\n<p>\u5728 JavaScript \u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u6570\u5b66\u8fd0\u7b97\u7b26\u548c\u53d6\u6a21\u8fd0\u7b97\u7b26\u6765\u6b63\u786e\u53d6\u767e\u4f4d\u6570\u3002<\/p>\n<p><strong>\u6b65\u9aa4\uff1a<\/strong><\/p>\n<ol>\n<li>\u5c06\u6570\u5b57\u9664\u4ee5 100\u3002<\/li>\n<li>\u5bf9\u7ed3\u679c\u53d6\u6a21 100\u3002<\/li>\n<\/ol>\n<p><strong>\u4ee3\u7801\uff1a<\/strong><\/p>\n<pre>let number = 1234;\nlet hundredthDigit = number % 100 \/ 10;\nconsole.log(hundredthDigit); \/\/ 2<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p><strong>\u89e3\u91ca\uff1a<\/strong><\/p>\n<ul>\n<li>number % 100 \u4f1a\u5f97\u5230\u6570\u5b57\u672b\u5c3e\u7684\u4e24\u4f4d\u6570\uff0c\u5373 23\u3002<\/li>\n<li>23 \/ 10 \u4f1a\u5f97\u5230\u767e\u4f4d\u6570\uff0c\u5373 2\u3002<\/li>\n<\/ul>\n<p><strong>\u5176\u4ed6\u65b9\u6cd5\uff1a<\/strong><\/p>\n<p>\u9664\u4e86\u4e0a\u8ff0\u65b9\u6cd5\u5916\uff0c\u8fd8\u53ef\u4ee5\u4f7f\u7528 Math.floor() \u51fd\u6570\uff1a<\/p>\n<pre>let hundredthDigit = Math.floor((number \/ 100) % 10);<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fjs\u5982\u4f55\u6b63\u786e\u7684\u53d6\u767e\u4f4d\u6570\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>\u5728 javascript \u4e2d\uff0c\u6b63\u786e\u53d6\u767e\u4f4d\u6570\u7684\u65b9\u6cd5\u662f\uff1a\u5c06\u6570\u5b57\u9664\u4ee5 100\u3002\u5bf9\u7ed3\u679c\u53d6\u6a21 100\u3002 \u5982\u4f55\u6b63\u786e\u53d6\u767e\u4f4d\u6570 \u5728 JavaScript \u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u6570\u5b66\u8fd0\u7b97\u7b26\u548c\u53d6\u6a21\u8fd0\u7b97\u7b26\u6765\u6b63\u786e\u53d6\u767e\u4f4d\u6570\u3002 \u6b65\u9aa4\uff1a \u5c06\u6570\u5b57\u9664\u4ee5 100\u3002 \u5bf9\u7ed3\u679c\u53d6\u6a21 100\u3002 \u4ee3\u7801\uff1a let number = 1234; let hundredthDigit = number % 100 \/ 10; console.log(hundredthDigit); \/\/ 2 \u767b\u5f55\u540e\u590d\u5236 \u89e3\u91ca\uff1a number % 100 \u4f1a\u5f97\u5230\u6570\u5b57\u672b\u5c3e\u7684\u4e24\u4f4d\u6570\uff0c\u5373 23\u3002 23 \/ 10 \u4f1a\u5f97\u5230\u767e\u4f4d\u6570\uff0c\u5373 2\u3002 \u5176\u4ed6\u65b9\u6cd5\uff1a \u9664\u4e86\u4e0a\u8ff0\u65b9\u6cd5\u5916\uff0c\u8fd8\u53ef\u4ee5\u4f7f\u7528 Math.floor() \u51fd\u6570\uff1a let hundredthDigit = Math.floor((number \/ 100) % 10); \u767b\u5f55\u540e\u590d\u5236 [&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-3398","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/3398","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=3398"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/3398\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=3398"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=3398"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=3398"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}