ava中的变量分类:
(1):基本数据类型
(2):引用数据类型
js中的变量类型:
(1):原始类型
number 数字/不分整型或浮点型
string 字符串
boolean 布尔
null 一般人为来赋值为null. 对象数据类型的占位符.
undefined null的衍生值. 通常是系统自动赋值.当我们创建一个变量,并且没有初始化.
var a = 10;
var b =1.5;
var c =”panpan”;
var d = ‘cnblue’;
var e = true;
var f = null;
var g = undefined;
var h;
var i = new Object();
运算符typeof用来返回原始类型;
<html>
<head>
<title>js的语法.html</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script type="text/javascript">
var a = 10;
var b =1.5;
var c ="panpan";
var d = 'cnblue';
var e = true;
var f = null;
var g = undefined;
var h;
var i = new Object();
alert(typeof a);
alert(typeof b);
alert(typeof c);
alert(typeof d);
alert(typeof e);
alert(typeof f);
alert(typeof g);
alert(typeof h);
alert(typeof i);
</script>
</head>
<body>
</body>
</html>
注意:
// typeof null => object
// 是javascript中的一个bug.后来将该bug保留了.
(2):对象类型
861

被折叠的 条评论
为什么被折叠?



