标签:code 数字 function UNC har str func abc script
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Typeof</title> <script> //对象不存在时返回null //变量未被赋值是undefined var test1 = "abcdef"; var test2 = 123; var test3 = true; var test4 = {}; var test5 = []; var test6; var test7 = {"abcdef": 123}; var test8 = ["abac", 123]; function test9(){return "avc"}; var test10 = null; console.log(typeof test10) //NaN是无法表示的数值,无法自身比较NaN != NaN, NaN与任何东西都不相等 //判断NaN,任何不是数字的值传给isNaN返回的结果都是true var myNum; if (isNaN(myNum)){ myNum = 0; } alert(myNum); //Infinity指的是超过数据上限或这下限的值 if (99 == "99"){ console.log("A number equals a string"); } else { console.log("No way a number equals a strings"); } </script> </head> <body> </body> </html>
标签:code 数字 function UNC har str func abc script
原文地址:https://www.cnblogs.com/themost/p/9313895.html