{"id":3399,"date":"2024-11-10T08:52:20","date_gmt":"2024-11-10T00:52:20","guid":{"rendered":"https:\/\/fwq.ai\/blog\/3399\/"},"modified":"2024-11-10T08:52:20","modified_gmt":"2024-11-10T00:52:20","slug":"%e5%a6%82%e4%bd%95%e8%ae%a91%e5%8a%a01%e7%ad%89%e4%ba%8e3js","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/3399\/","title":{"rendered":"\u5982\u4f55\u8ba91\u52a01\u7b49\u4e8e3js"},"content":{"rendered":"<blockquote><p>\n  \u5728 javascript \u4e2d\uff0c1 \u52a0 1 \u59cb\u7ec8\u7b49\u4e8e 2\uff0c\u65e0\u6cd5\u901a\u8fc7\u6570\u5b66\u8fd0\u7b97\u4f7f\u5176\u7b49\u4e8e 3\u3002\u7136\u800c\uff0c\u53ef\u4ee5\u4f7f\u7528\u6280\u5de7\u7ed5\u8fc7\u9650\u5236\uff1a\u5b57\u7b26\u4e32\u8fde\u63a5\uff1a&#8221;1&#8243; + &#8220;1&#8221; = &#8220;11&#8221;\u4f4d\u8fd0\u7b97\uff1a1 | 1 = 011\uff083\uff09\u51fd\u6570\u8c03\u7528\uff1aadd(1, 1) = 3\u91cd\u8f7d\u8fd0\u7b97\u7b26\uff1anumber.prototype.add(1, 1) = 3\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202411\/08\/2024110811310982389.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u8ba91\u52a01\u7b49\u4e8e3js\u63d2\u56fe\" alt=\"\u5982\u4f55\u8ba91\u52a01\u7b49\u4e8e3js\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u8ba9 1 \u52a0 1 \u7b49\u4e8e 3\uff08JS\uff09<\/strong><\/p>\n<p>\u5728 JavaScript \u4e2d\uff0c1 \u52a0 1 \u59cb\u7ec8\u7b49\u4e8e 2\u3002\u7136\u800c\uff0c\u53ef\u4ee5\u4f7f\u7528\u4e00\u4e9b\u6280\u5de7\u6765\u7ed5\u8fc7\u8fd9\u4e00\u9650\u5236\u3002<\/p>\n<p><strong>\u65b9\u6cd5 1\uff1a\u5b57\u7b26\u4e32\u8fde\u63a5<\/strong><\/p>\n<p>const result = &#8220;1&#8221; + &#8220;1&#8221;;<\/p>\n<p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u5b57\u7b26\u4e32 &#8220;1&#8221; \u548c &#8220;1&#8221; \u5c06\u88ab\u8fde\u63a5\u5728\u4e00\u8d77\uff0c\u7ed3\u679c\u4e3a &#8220;11&#8221;\u3002<\/p>\n<p><strong>\u65b9\u6cd5 2\uff1a\u4f4d\u8fd0\u7b97<\/strong><\/p>\n<p>const result = 1 | 1;<\/p>\n<p>\u6309\u4f4d OR \u8fd0\u7b97\u7b26 (|) \u5c06\u4e24\u4e2a\u6570\u5b57\u7684\u4e8c\u8fdb\u5236\u8868\u793a\u4e2d\u7684 1 \u4f4d\u5408\u5e76\u30021 \u7684\u4e8c\u8fdb\u5236\u8868\u793a\u4e3a 01\uff0c\u56e0\u6b64 1 | 1 \u7b49\u4e8e 01 | 01 = 011\uff083\uff09\u3002<\/p>\n<p><strong>\u65b9\u6cd5 3\uff1a\u51fd\u6570\u8c03\u7528<\/strong><\/p>\n<pre>function add(a, b) {\n  return a + b + 1;\n}\n\nconst result = add(1, 1);<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u6b64\u65b9\u6cd5\u6d89\u53ca\u521b\u5efa\u4e00\u4e2a\u81ea\u5b9a\u4e49\u51fd\u6570\uff0c\u8be5\u51fd\u6570\u5728\u4e24\u4e2a\u6570\u5b57\u76f8\u52a0\u540e\u6dfb\u52a0 1\u3002<\/p>\n<p><strong>\u65b9\u6cd5 4\uff1a\u91cd\u8f7d\u8fd0\u7b97\u7b26<\/strong><\/p>\n<p>&#8220;Number.prototype.add = function(other) {<br \/> return this.valueOf() + other + 1;<br \/>};&#8220;<\/p>\n<p>\u6b64\u65b9\u6cd5\u91cd\u8f7d + \u8fd0\u7b97\u7b26\uff0c\u4ee5\u4fbf\u5b83\u5728 JavaScript Number \u5bf9\u8c61\u4e0a\u6267\u884c\u81ea\u5b9a\u4e49\u884c\u4e3a\u3002<\/p>\n<p><strong>\u6ce8\u610f\uff1a<\/strong><\/p>\n<p>\u867d\u7136\u8fd9\u4e9b\u6280\u5de7\u53ef\u4ee5\u8ba9\u4f60\u5728 JavaScript \u4e2d\u5f97\u5230\u4e00\u4e2a\u6570\u5b57\u503c\uff0c\u4f46\u5b83\u4eec\u5e76\u4e0d\u662f\u8ba9 1 \u52a0 1 \u7b49\u4e8e 3 \u7684\u771f\u6b63\u89e3\u51b3\u65b9\u6848\u3002\u5b83\u4eec\u53ea\u662f\u901a\u8fc7\u64cd\u7eb5\u5b57\u7b26\u4e32\u3001\u4f4d\u6216\u51fd\u6570\u6765\u83b7\u5f97\u6240\u9700\u7684\u8f93\u51fa\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u8ba91\u52a01\u7b49\u4e8e3js\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\uff0c1 \u52a0 1 \u59cb\u7ec8\u7b49\u4e8e 2\uff0c\u65e0\u6cd5\u901a\u8fc7\u6570\u5b66\u8fd0\u7b97\u4f7f\u5176\u7b49\u4e8e 3\u3002\u7136\u800c\uff0c\u53ef\u4ee5\u4f7f\u7528\u6280\u5de7\u7ed5\u8fc7\u9650\u5236\uff1a\u5b57\u7b26\u4e32\u8fde\u63a5\uff1a&#8221;1&#8243; + &#8220;1&#8221; = &#8220;11&#8221;\u4f4d\u8fd0\u7b97\uff1a1 | 1 = 011\uff083\uff09\u51fd\u6570\u8c03\u7528\uff1aadd(1, 1) = 3\u91cd\u8f7d\u8fd0\u7b97\u7b26\uff1anumber.prototype.add(1, 1) = 3 \u5982\u4f55\u8ba9 1 \u52a0 1 \u7b49\u4e8e 3\uff08JS\uff09 \u5728 JavaScript \u4e2d\uff0c1 \u52a0 1 \u59cb\u7ec8\u7b49\u4e8e 2\u3002\u7136\u800c\uff0c\u53ef\u4ee5\u4f7f\u7528\u4e00\u4e9b\u6280\u5de7\u6765\u7ed5\u8fc7\u8fd9\u4e00\u9650\u5236\u3002 \u65b9\u6cd5 1\uff1a\u5b57\u7b26\u4e32\u8fde\u63a5 const result = &#8220;1&#8221; + &#8220;1&#8221;; \u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u5b57\u7b26\u4e32 &#8220;1&#8221; \u548c &#8220;1&#8221; \u5c06\u88ab\u8fde\u63a5\u5728\u4e00\u8d77\uff0c\u7ed3\u679c\u4e3a &#8220;11&#8221;\u3002 \u65b9\u6cd5 2\uff1a\u4f4d\u8fd0\u7b97 const result = 1 [&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-3399","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/3399","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=3399"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/3399\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=3399"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=3399"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=3399"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}