{"id":2723,"date":"2023-11-14T14:26:31","date_gmt":"2023-11-14T06:26:31","guid":{"rendered":""},"modified":"2023-11-14T14:26:31","modified_gmt":"2023-11-14T06:26:31","slug":"JavaScript typeof","status":"publish","type":"post","link":"https:\/\/bianchenghao6.com\/2723.html","title":{"rendered":"JavaScript typeof"},"content":{"rendered":"
typeof operand
or
typeof (operand)
<\/span><\/code><\/pre>\n<\/div>\n\u503c<\/h3>\n\n \u64cd\u4f5c\u6570\uff1a<\/strong>\uff1a\u5b83\u662f\u8868\u793a\u8981\u8fd4\u56de\u5176\u7c7b\u578b\u7684\u5bf9\u8c61\u6216\u57fa\u5143\u7684\u8868\u8fbe\u5f0f\u3002\n<\/div>\n\n typeof <\/strong>\u8fd0\u7b97\u7b26\u7684\u53ef\u80fd\u8fd4\u56de\u503c\u5217\u8868\u5982\u4e0b\uff1a\n<\/div>\n\n\n\n\u64cd\u4f5c\u6570\u7684\u7c7b\u578b<\/td>\n \u7ed3\u679c<\/td>\n<\/tr>\n \n object<\/strong> <\/td>\n\"\u5bf9\u8c61\" <\/td>\n<\/tr>\n \n number<\/strong> <\/td>\n\"\u6570\u5b57\" <\/td>\n<\/tr>\n \n string<\/strong> <\/td>\n\"\u5b57\u7b26\u4e32\" <\/td>\n<\/tr>\n \n boolean<\/strong> <\/td>\n\"\u5e03\u5c14\u503c\" <\/td>\n<\/tr>\n \n function<\/strong> <\/td>\n\"\u529f\u80fd\" <\/td>\n<\/tr>\n \n undefined<\/strong> <\/td>\n\"\u672a\u5b9a\u4e49\" <\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\n \u8ba9\u6211\u4eec\u901a\u8fc7\u4e00\u4e9b\u793a\u4f8b\u6765\u4e86\u89e3\u6b64\u8fd0\u7b97\u7b26\u3002\n<\/div>\n Example1 <\/h3>\n\n \u5728\u6b64\u793a\u4f8b\u4e2d\uff0c\u64cd\u4f5c\u6570\u662f\u6570\u5b57\u7c7b\u578b\u3002
\n typeof <\/strong>\u8fd0\u7b97\u7b26\u5c06\u6253\u5370
\n \"\u6570\u5b57\" <\/strong>\u4f5c\u4e3a\u64cd\u4f5c\u6570\u7684\u7c7b\u578b\uff0c\u65e0\u8bba\u64cd\u4f5c\u6570\u662f\u8d1f\u6574\u6570\uff0c\u6d6e\u70b9\u6570\uff0c\u65e0\u7a77\u5927\uff0cNaN\uff0c\u96f6\u8fd8\u662f\u4efb\u4f55\u6574\u6570\u3002\n<\/div>\n\n <html>
<head>
<script>
document.write<\/span>(typeof (45) + \"<br>\"); \/\/ results: \"number\"
document.write<\/span>(typeof (-90) + \"<br>\"); \/\/ results: \"number\"
document.write<\/span>(typeof (0) + \"<br>\"); \/\/ results: \"number\"
document.write<\/span>(typeof (22.6) + \"<br>\"); \/\/ results: \"number\"
document.write<\/span>(typeof (Infinity) + \"<br>\"); \/\/ results: \"number\"
document.write<\/span>(typeof (NaN)); \/\/ results: \"number\". Although NaN is \"Not-A-Number\"
<\/script>
<\/head>
<body>
<\/body>
<\/html>
<\/span><\/code><\/pre>\n<\/div>\n\n \u8f93\u51fa<\/strong>\n<\/div>\n\n