关于JS中的数据类型
来源:互联网 发布:淘宝军工手机怎么样 编辑:程序博客网 时间:2024/05/29 06:29
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
</head>
<body>
</body>
</html>
<script>
var a="hxsd";
var b=12314;
var c;
var d=true;
function run(){};
var oDiv=document.getElementById('box');
var arr=[a,b,c];
//tpyeof 6种
//alert(typeof a);//string
//alert(typeof b); //number
//alert(typeof c);//undefined
//alert(typeof d);//boolean
//alert(typeof run);//function
//alert(typeof document.body); //object
//alert(typeof oDiv); //null 也是 object
//alert(typeof arr); //数组 也是 object
//-------------------------------------------
/*
alert(c); //undefined
if(c==undefined){ //直接判断c的值
alert("ok");
};*/
//tpyeof的6种类型,也是字符串,在判断语句当中,应该加上" "
//alert(typeof c);
if(typeof c=="undefined"){//判断c的“值的类型”
alert("ok")
}
</script>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
</head>
<body>
</body>
</html>
<script>
var a="hxsd";
var b=12314;
var c;
var d=true;
function run(){};
var oDiv=document.getElementById('box');
var arr=[a,b,c];
//tpyeof 6种
//alert(typeof a);//string
//alert(typeof b); //number
//alert(typeof c);//undefined
//alert(typeof d);//boolean
//alert(typeof run);//function
//alert(typeof document.body); //object
//alert(typeof oDiv); //null 也是 object
//alert(typeof arr); //数组 也是 object
//-------------------------------------------
/*
alert(c); //undefined
if(c==undefined){ //直接判断c的值
alert("ok");
};*/
//tpyeof的6种类型,也是字符串,在判断语句当中,应该加上" "
//alert(typeof c);
if(typeof c=="undefined"){//判断c的“值的类型”
alert("ok")
}
</script>
阅读全文
0 0
- 关于js中的数据类型
- 关于JS中的数据类型
- js中的数据类型
- JS中的数据类型
- js中的数据类型
- 判断js中的数据类型
- js中的数据类型
- js中的数据类型转换
- 【js】:javascript中的数据类型
- js中的数据类型
- js中的数据类型
- js中的数据类型
- JS中的Symbol数据类型
- js中的数据类型
- js中的数据类型
- js中的基本数据类型
- JS中的数据类型
- 判断js中的数据类型
- 数据结构-顺序表的基本操作
- java环境搭建
- Xcode commit提交报错
- 利用Hash查找的算法存储通讯录
- OnMouseMove移动位置和OnMouseWheel缩放实现
- 关于JS中的数据类型
- java数字签名
- CodeChef MOU2H
- c语句
- JSP中获取用户IP的两种方式
- poj 图相关之1094Sorting It All Out
- mybatis源码分析-注解-1
- Android学习资料收集
- 史上最详细:在VMware虚拟机里搭建DB2 purescale测试