数据类型

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>


<script>
/*
数据类型:
基本类型:
Number Boolean String Undefined Null

引用类型:
Object Array Function Date Math...
*/
/*
1.Number (数值类型)
-合法的整数或者浮点数
-NaN not a number (不是一个数字)
-Infinity 正无穷 -Infinity 负无穷
*/
// var a = -Infinity;
// // 运算符 typeof 表达式 1+1 1<2 和 值 2 对
// console.log(a);
// console.log(typeof a);

/*
String: 字符类型
-在双引号或者单引号里面的内容就是String
*/
// var a = "张三说:\"我很帅\""
// console.log(a);
// console.log(typeof a);

 

/*
Boolean:布尔类型
- true 对 真 false 错 假 逻辑判断
*/
// var a = false;
// console.log(a);
// console.log(typeof a);


/*
Undefined:未定义的
声明变量未赋值
*/
// var a;
// console.log(a);
// console.log(typeof a);

/*
Null 空对象
typeof 以后是 object
*/
// var a = null;
// console.log(a)
// console.log(typeof a)


// var a = 10;
// console.log(a);
// a = null;

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

</script>

</body>
</html>

posted @ 2023-08-15 23:51  进击的程序员3321  阅读(6)  评论(0)    收藏  举报