1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 6 <title>Document</title> 7 8 <script> 9 /* 10 1 JS中的变量的声明都用var var i =10; var string = "asds" 11 JS是弱类型的,不是没有类型,是赋值时才确定类型 12 2 JS中常见的数据类型 13 数值类型 number 整数 小数 14 字符串类型 string 15 布尔类型 boolean 16 引用类型 Object 只有Object能赋 null值 17 function类型 function 18 命名未赋值 undefined 值 undefined 19 赋予null Object 值 null 20 3判断数据类型的运算符 typeof 21 */ 22 var i = 20 23 console.log(i) 24 console.log(typeof i) 25 26 var i = 'asdf' 27 console.log(i) 28 console.log(typeof i) 29 30 var i = 1>10 31 console.log(i) 32 console.log(typeof i) 33 34 var i = new Object() 35 console.log(i) 36 console.log(typeof i) 37 38 var fun1 = function (){} 39 console.log(fun1) 40 console.log(typeof fun1) 41 42 var y 43 console.log(y) 44 console.log(typeof y) 45 46 var x = null 47 console.log(x) 48 console.log(typeof x) 49 50 </script> 51 52 </head> 53 <body> 54 55 </body> 56 </html>
标签:02,console,变量,Object,数据类型,typeof,var,log From: https://www.cnblogs.com/IrVolcano/p/18074186