标签:body htm bool ons def pre doctype 数据 title
boolean; number; string; object; undefined
常见数据类型
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript">
function f() {
}
var s = "";
s+="typeof true:\t\t\t"+typeof true+"\n"
s+="typeof 3.3:\t\t\t\t"+typeof 3+"\n"
s+="typeof ‘hello‘:\t\t\t"+typeof ‘hello‘+"\n"
s+="typeof f :\t\t\t\t"+typeof f+"\n";
s+="typeof new Array(1,2,):\t"+typeof new Array(1,2)+"\n"
s+="typeof [1,3]:\t\t\t"+typeof [1,3]+"\n"
s+="typeof null:\t\t\t"+typeof null+"\n"
s+="typeof undefined:\t\t"+typeof undefined+"\n"
console.log(s)
/*结果如下:
typeof true: boolean
typeof 3.3: number
typeof ‘hello‘: string
typeof f : function
typeof new Array(1,2,): object
typeof [1,3]: object
typeof null: object
typeof undefined: undefined*/
</script>
</head>
<body>
</body>
</html>
标签:body htm bool ons def pre doctype 数据 title
原文地址:https://www.cnblogs.com/yldf/p/9385384.html