{"id":296,"date":"2023-09-21T19:05:51","date_gmt":"2023-09-21T11:05:51","guid":{"rendered":"https:\/\/www.qzdd.net\/?p=296"},"modified":"2023-09-21T19:05:51","modified_gmt":"2023-09-21T11:05:51","slug":"js%e6%95%b0%e6%8d%ae%e7%b1%bb%e5%9e%8b%e8%bd%ac%e6%8d%a2","status":"publish","type":"post","link":"https:\/\/www.qzdd.net\/?p=296","title":{"rendered":"JS\u6570\u636e\u7c7b\u578b\u8f6c\u6362"},"content":{"rendered":"\n<figure class=\"wp-block-table\"><table><tbody><tr><th><strong>\u539f\u59cb\u503c<\/strong><\/th><th><strong>\u8f6c\u6362\u4e3a\u6570\u5b57<\/strong><\/th><th>\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32<\/th><th>\u8f6c\u6362\u4e3a\u903b\u8f91<\/th><\/tr><tr><td>false<\/td><td>0<\/td><td>&#8220;false&#8221;<\/td><td>false<\/td><\/tr><tr><td>true<\/td><td>1<\/td><td>&#8220;true&#8221;<\/td><td>true<\/td><\/tr><tr><td>0<\/td><td>0<\/td><td>&#8220;0&#8221;<\/td><td>false<\/td><\/tr><tr><td>1<\/td><td>1<\/td><td>&#8220;1&#8221;<\/td><td>true<\/td><\/tr><tr><td>&#8220;0&#8221;<\/td><td>0<\/td><td>&#8220;0&#8221;<\/td><td><code><mark style=\"background-color:rgba(0, 0, 0, 0);color:#fc0404\" class=\"has-inline-color\">true<\/mark><\/code><\/td><\/tr><tr><td>&#8220;000&#8221;<\/td><td>0<\/td><td>&#8220;000&#8221;<\/td><td><code><mark style=\"background-color:rgba(0, 0, 0, 0);color:#ff0000\" class=\"has-inline-color\">true<\/mark><\/code><\/td><\/tr><tr><td>&#8220;1&#8221;<\/td><td>1<\/td><td>&#8220;1&#8221;<\/td><td>true<\/td><\/tr><tr><td>NaN<\/td><td>NaN<\/td><td>&#8220;NaN&#8221;<\/td><td>false<\/td><\/tr><tr><td>Infinity<\/td><td>Infinity<\/td><td>&#8220;Infinity&#8221;<\/td><td>true<\/td><\/tr><tr><td>-Infinity<\/td><td>-Infinity<\/td><td>&#8220;-Infinity&#8221;<\/td><td>true<\/td><\/tr><tr><td>&#8220;&#8221;<\/td><td><code><mark style=\"background-color:rgba(0, 0, 0, 0);color:#fa0404\" class=\"has-inline-color\">0<\/mark><\/code><\/td><td>&#8220;&#8221;<\/td><td><code>false<\/code><\/td><\/tr><tr><td>&#8220;20&#8221;<\/td><td>20<\/td><td>&#8220;20&#8221;<\/td><td>true<\/td><\/tr><tr><td>&#8220;twenty&#8221;<\/td><td>NaN<\/td><td>&#8220;twenty&#8221;<\/td><td>true<\/td><\/tr><tr><td>[ ]<\/td><td><code><mark style=\"background-color:rgba(0, 0, 0, 0);color:#fb0101\" class=\"has-inline-color\">0<\/mark><\/code><\/td><td>&#8220;&#8221;<\/td><td>true<\/td><\/tr><tr><td>[20]<\/td><td><code><mark style=\"background-color:rgba(0, 0, 0, 0);color:#f60000\" class=\"has-inline-color\">20<\/mark><\/code><\/td><td>&#8220;20&#8221;<\/td><td>true<\/td><\/tr><tr><td>[10,20]<\/td><td>NaN<\/td><td>&#8220;10,20&#8221;<\/td><td>true<\/td><\/tr><tr><td>[&#8220;twenty&#8221;]<\/td><td>NaN<\/td><td>&#8220;twenty&#8221;<\/td><td>true<\/td><\/tr><tr><td>[&#8220;ten&#8221;,&#8221;twenty&#8221;]<\/td><td>NaN<\/td><td>&#8220;ten,twenty&#8221;<\/td><td>true<\/td><\/tr><tr><td>function(){}<\/td><td>NaN<\/td><td>&#8220;function(){}&#8221;<\/td><td>true<\/td><\/tr><tr><td>{ }<\/td><td>NaN<\/td><td>&#8220;[object Object]&#8221;<\/td><td>true<\/td><\/tr><tr><td>null<\/td><td><code><mark style=\"background-color:rgba(0, 0, 0, 0);color:#fc0101\" class=\"has-inline-color\">0<\/mark><\/code><\/td><td>&#8220;null&#8221;<\/td><td>false<\/td><\/tr><tr><td>undefined<\/td><td>NaN<\/td><td>&#8220;undefined&#8221;<\/td><td>false<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u4e0b\u5217\u7ed3\u679c\u662ftrue\uff1a\uff08== \u64cd\u4f5c\u7b26\u6c38\u8fdc\u4e0d\u4f1a\u5c06\u64cd\u4f5c\u6570\u8f6c\u6362\u4e3aboolean\uff09<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>null == undefined  \/\/ \u7279\u6b8a<\/li>\n\n\n\n<li>undefined == undefined<\/li>\n\n\n\n<li>null == null<\/li>\n\n\n\n<li>0 == &#8220;0&#8221;  \/\/ \u4e24\u4e2a\u64cd\u4f5c\u6570<strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#fa0000\" class=\"has-inline-color\">\u5148\u8f6c\u6362\u4e3a\u6570\u5b57<\/mark><\/strong>\u518d\u6bd4\u8f83<\/li>\n\n\n\n<li>0 == &#8220;&#8221; \/\/ \u4e24\u4e2a\u64cd\u4f5c\u6570<strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#fa0000\" class=\"has-inline-color\">\u5148\u8f6c\u6362\u4e3a\u6570\u5b57<\/mark><\/strong>\u518d\u6bd4\u8f83<\/li>\n\n\n\n<li>0 == false  \/\/ \u4e24\u4e2a\u64cd\u4f5c\u6570<strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#fa0000\" class=\"has-inline-color\">\u5148\u8f6c\u6362\u4e3a\u6570\u5b57<\/mark><\/strong>\u518d\u6bd4\u8f83<\/li>\n\n\n\n<li>&#8220;0&#8221; == false  \/\/ \u4e24\u4e2a\u64cd\u4f5c\u6570<strong><mark style=\"background-color:rgba(0, 0, 0, 0);color:#fa0000\" class=\"has-inline-color\">\u5148\u8f6c\u6362\u4e3a\u6570\u5b57<\/mark><\/strong>\u518d\u6bd4\u8f83<\/li>\n<\/ul>\n\n\n\n<p>\u4e0b\u5217\u7ed3\u679c\u662ffalse:\uff08\u4e0d\u4f1a\u53d1\u751f\u7c7b\u578b\u8f6c\u6362\uff09<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>undefined == false<\/li>\n\n\n\n<li>undefined == true<\/li>\n\n\n\n<li>undefined == 0<\/li>\n\n\n\n<li>undefined == &#8220;0&#8221;<\/li>\n\n\n\n<li>undefined == &#8220;&#8221;<\/li>\n\n\n\n<li>null == false<\/li>\n\n\n\n<li>null == true<\/li>\n\n\n\n<li>null == 0<\/li>\n\n\n\n<li>null == &#8220;0&#8221;<\/li>\n\n\n\n<li>null == &#8220;&#8221;<\/li>\n<\/ul>\n\n\n\n<p>\u5b57\u7b26\u4e32\u9690\u5f0f\u8f6c\u6362\u6570\u5b57\u65f6\u652f\u6301\u524d\u540e\u6709\u7a7a\u683c\uff0c\u4f46\u5176\u4ed6\u7d22\u5f15\u4f4d\u7f6e\u7684\u5b57\u7b26\u5fc5\u987b\u4e3a\u6570\u5b57\uff0c\u5426\u5219\u7ed3\u679c\u4e3a<strong>NaN<\/strong>\u3002<\/p>\n\n\n\n<p>parseFloat\uff0cparseInt \u5b57\u7b26\u4e32<strong>\u5f00\u5934\u6709\u6570\u5b57<\/strong>\u5c31\u53ef\u4ee5\u6709\u6570\u503c\u7ed3\u679c\uff0c\u8f6c\u5230\u4e0d\u80fd\u8f6c\u6362\u7684\u7d22\u5f15\u4f4d\u7f6e\u65f6\u505c\u6b62\uff0c\u8f93\u51fa\u7ed3\u679c\u4e3a\u524d\u9762\u5df2\u8f6c\u597d\u7684\u6570\u5b57\uff08\u80fd\u8f6c\u51e0\u4e2a\u7b97\u51e0\u4e2a\uff09\uff0c\u5f00\u5934\u5982\u679c\u975e\u6570\u5b57\u76f4\u63a5NaN\u3002<\/p>\n\n\n\n<p>\u6570\u7ec4\u8f6c\u6362\u6570\u503c\u65f6\uff0c\u9ed8\u8ba4\u8c03\u7528toString()\u65b9\u6cd5\u5148\u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32\uff0c\u518d\u7531\u5b57\u7b26\u4e32\u8f6c\u6362\u4e3a\u6570\u503c\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>toString(\u57fa\u6570)\u53ef\u4ee5\u8f93\u51fa\u6307\u5b9a\u57fa\u6570\u7684\u6570\u503c\uff08\u7528\u4e8e<em><strong>\u5341\u8fdb\u5236\u8f6c\u5176\u4ed6<\/strong><\/em>\uff09\uff0cparseFloat,parseInt\u53ef\u4ee5\u6309\u6307\u5b9a\u57fa\u6570\u89e3\u6790\u5b57\u7b26\u4e32<strong><em>\u8fd4\u56de\u5341\u8fdb\u5236\u6570\u503c<\/em><\/strong>\u3002\uff08\u57fa\u672c\u4e0a\u8868\u8fbe\u5f0f\u8fd4\u56de\u7684\u6570\u5b57\u90fd\u662f\u5341\u8fdb\u5236\u6570\u503c\uff0c\u9664\u975e\u7528toString\u6307\u5b9a\u5176\u4ed6\u57fa\u6570\uff09<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u539f\u59cb\u503c \u8f6c\u6362\u4e3a\u6570\u5b57 \u8f6c\u6362\u4e3a\u5b57\u7b26\u4e32 \u8f6c\u6362\u4e3a\u903b\u8f91 false 0 &#8220;false&#8221; fals [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[86],"class_list":["post-296","post","type-post","status-publish","format-standard","hentry","category-base","tag-86"],"_links":{"self":[{"href":"https:\/\/www.qzdd.net\/index.php?rest_route=\/wp\/v2\/posts\/296","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.qzdd.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.qzdd.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.qzdd.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.qzdd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=296"}],"version-history":[{"count":0,"href":"https:\/\/www.qzdd.net\/index.php?rest_route=\/wp\/v2\/posts\/296\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.qzdd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=296"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qzdd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=296"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qzdd.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=296"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}