1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="UTF-8"> 5 <title></title> 6 </head> 7 <body> 8 </body> 9 <script type="text/javascript"> 10 11 var number1 = 1, number2 = 2; 12 //数据类型,js 里面是弱类型 可以进行类型自动推断 13 数字类型1 Number 14 var value1 = 5; 15 console.log(typeof 5); 16 var value2 = 5.1; 17 console.log(typeof value2); 18 类型二:undefined 19 var value3; 20 console.log(typeof value3); 21 类型三:null 22 var value4 = null; 23 console.log(typeof value4); 24 类型四 string 25 var value5 = "我很好"; 26 console.log(typeof value5); 27 类型五 bool 类型 28 console.log(typeof true); 29 30 //对于 number 类型的补充 31 var value1 = 0xFF; 32 console.log(value1); 33 var value2 = 012; 34 console.log(value2); 35 </script> 36 37 </html>
时间: 2024-11-09 20:10:37