{"id":5398,"date":"2023-01-05T12:36:24","date_gmt":"2023-01-05T04:36:24","guid":{"rendered":"https:\/\/badgameshow.com\/steven\/?p=5398"},"modified":"2023-01-05T12:36:24","modified_gmt":"2023-01-05T04:36:24","slug":"%e4%ba%86%e8%a7%a3typescript%e4%b8%ad%e9%99%a3%e5%88%97%e7%9a%84isfalse%e5%87%bd%e6%95%b8%e5%8a%9f%e8%83%bd","status":"publish","type":"post","link":"https:\/\/badgameshow.com\/steven\/typescript\/%e4%ba%86%e8%a7%a3typescript%e4%b8%ad%e9%99%a3%e5%88%97%e7%9a%84isfalse%e5%87%bd%e6%95%b8%e5%8a%9f%e8%83%bd\/","title":{"rendered":"\u4e86\u89e3TypeScript\u4e2d\u9663\u5217\u7684isFalse()\u51fd\u6578\u529f\u80fd"},"content":{"rendered":"<p><meta name=\"keywords\" content=\"TypeScript, \u9663\u5217, \u6c42\u507d, isFalse\"><\/p>\n<h1>TypeScript \u9663\u5217\u7684\u6c42\u662f\u5426\u70ba\u507d(isFalse)<\/h1>\n<p>TypeScript \u662f\u4e00\u7a2e JavaScript \u7684\u8d85\u96c6\uff0c\u5b83\u64c1\u6709\u66f4\u591a\u7684\u529f\u80fd\uff0c\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u66f4\u5bb9\u6613\u958b\u767c\u51fa\u66f4\u512a\u8cea\u7684\u7a0b\u5f0f\u78bc\u3002\u5728 TypeScript \u4e2d\uff0c\u958b\u767c\u8005\u53ef\u4ee5\u4f7f\u7528 isFalse \u9019\u500b\u51fd\u5f0f\u4f86\u6aa2\u67e5\u9663\u5217\u4e2d\u7684\u503c\u662f\u5426\u70ba\u507d\u3002<\/p>\n<h2>isFalse \u51fd\u5f0f\u7684\u4f7f\u7528\u65b9\u6cd5<\/h2>\n<p>isFalse \u51fd\u5f0f\u53ef\u4ee5\u6aa2\u67e5\u9663\u5217\u4e2d\u7684\u503c\u662f\u5426\u70ba\u507d\uff0c\u5b83\u6703\u56de\u50b3\u4e00\u500b\u5e03\u6797\u503c\uff0c\u5982\u679c\u9663\u5217\u4e2d\u7684\u503c\u70ba\u507d\uff0c\u5247\u56de\u50b3 true\uff0c\u53cd\u4e4b\u5247\u56de\u50b3 false\u3002<\/p>\n<pre class=\"brush: typescript\">\nlet arr = [false, 0, \"\", null, undefined];\nlet result = arr.every(isFalse);\nconsole.log(result); \/\/ true\n<\/pre>\n<p>\u4e0a\u9762\u7684\u7a0b\u5f0f\u78bc\u4e2d\uff0c\u6211\u5011\u5b9a\u7fa9\u4e86\u4e00\u500b\u9663\u5217 arr\uff0c\u88e1\u9762\u5305\u542b\u4e86\u4e00\u4e9b\u507d\u503c\uff0c\u7136\u5f8c\u6211\u5011\u4f7f\u7528 every \u51fd\u5f0f\u4f86\u6aa2\u67e5\u9663\u5217\u4e2d\u7684\u503c\u662f\u5426\u90fd\u70ba\u507d\uff0c\u6700\u5f8c\u6211\u5011\u5c07\u7d50\u679c\u8f38\u51fa\u5230\u63a7\u5236\u53f0\uff0c\u7d50\u679c\u70ba true\uff0c\u8868\u793a\u9663\u5217\u4e2d\u7684\u503c\u90fd\u70ba\u507d\u3002<\/p>\n<h2>isFalse \u51fd\u5f0f\u7684\u512a\u9ede<\/h2>\n<p>isFalse \u51fd\u5f0f\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u66f4\u5bb9\u6613\u6aa2\u67e5\u9663\u5217\u4e2d\u7684\u503c\u662f\u5426\u70ba\u507d\uff0c\u800c\u4e0d\u9700\u8981\u81ea\u5df1\u5beb\u4e00\u500b\u51fd\u5f0f\u4f86\u6aa2\u67e5\uff0c\u9019\u6a23\u53ef\u4ee5\u7bc0\u7701\u958b\u767c\u6642\u9593\uff0c\u4e5f\u53ef\u4ee5\u6e1b\u5c11\u7a0b\u5f0f\u78bc\u7684\u9577\u5ea6\uff0c\u63d0\u9ad8\u7a0b\u5f0f\u78bc\u7684\u53ef\u8b80\u6027\u3002<\/p>\n<h2>\u7e3d\u7d50<\/h2>\n<p>TypeScript \u63d0\u4f9b\u4e86 isFalse \u9019\u500b\u51fd\u5f0f\uff0c\u53ef\u4ee5\u8b93\u958b\u767c\u8005\u66f4\u5bb9\u6613\u6aa2\u67e5\u9663\u5217\u4e2d\u7684\u503c\u662f\u5426\u70ba\u507d\uff0c\u5b83\u53ef\u4ee5\u7bc0\u7701\u958b\u767c\u6642\u9593\uff0c\u4e5f\u53ef\u4ee5\u6e1b\u5c11\u7a0b\u5f0f\u78bc\u7684\u9577\u5ea6\uff0c\u63d0\u9ad8\u7a0b\u5f0f\u78bc\u7684\u53ef\u8b80\u6027\u3002<!--more--><\/p>\n<p>\u5982\u679c\u4f60\u60f3\u8981\u66f4\u6df1\u5165\u7684\u4e86\u89e3 TypeScript\uff0c\u53ef\u4ee5\u53c3\u8003 <a href=\"https:\/\/www.typescriptlang.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">TypeScript \u5b98\u65b9\u7db2\u7ad9<\/a>\uff0c\u88e1\u9762\u6709\u66f4\u591a\u7684\u8cc7\u6e90\u53ef\u4ee5\u53c3\u8003\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e86\u89e3TypeScript\u4e2d\u9663\u5217\u7684isFalse()\u51fd\u6578\u529f\u80fd\uff0c\u5b83\u53ef\u4ee5\u6aa2\u67e5\u9663\u5217\u4e2d\u7684\u503c\u662f\u5426\u70ba\u507d\uff0c\u4e26\u8fd4\u56de\u4e00\u500b\u5e03\u6797\u503c\uff0c\u4ee5\u4fbf\u60a8\u53ef\u4ee5\u66f4\u8f15\u9b06\u5730\u63a7\u5236\u7a0b\u5e8f\u7684\u6d41\u7a0b\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":[187],"tags":[186],"class_list":["post-5398","post","type-post","status-publish","format-standard","hentry","category-typescript","tag-typescript"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_shortlink":"https:\/\/wp.me\/pcFK27-1p4","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/5398","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=5398"}],"version-history":[{"count":1,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/5398\/revisions"}],"predecessor-version":[{"id":5399,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/5398\/revisions\/5399"}],"wp:attachment":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/media?parent=5398"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/categories?post=5398"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/tags?post=5398"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}