123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Document</title>
- </head>
- <body>
- <!--
-
- 弱语言类型
- 数据 决定 类型
- 检验类型的方法:
- typeof xxx
- null类型通过typeof会判断成object
- js数据类型:
- 基本数据类型:
- number 数字
- string 字符串
- null 空
- undefined 未定义的
- boolean 布尔值(true/false)
- 引用数据类型
- Object(数组[]/对象{}/函数)
- -->
- <script>
- var a = 10;
- console.log(typeof a);//number
- var b = '10';
- console.log(typeof b);//string
- var c = true;
- console.log(typeof c);//boolean
- var d = false;
- console.log(typeof d);//boolean
- var e;
- console.log(typeof e);//undefined
- var f = null; // null
- console.log(typeof f);//null类型通过typeof会判断成object
- var g = [1,2,3];
- console.log(typeof g);
- var h = {
- name:'小明'
- }
- console.log(typeof h)
- </script>
- </body>
- </html>
|