javascript 中被当做false的值:
a. false
b. null
c. undefined
d. 数字0
e. 空字符串
d.数字NaN
简单测试:
typeof:返回数据的类型:它所产生的值:'number','string','boolean','undefined','function','object'
简单使用
a. false
b. null
c. undefined
d. 数字0
e. 空字符串
d.数字NaN
简单测试:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> javascript</TITLE>
<script language="javascript">
var a='';//""
var b=NaN;
var c=0;
var d= null;
var e= undefined;
var f= false;
var h;// undefined
function false_show(){
if(a)alert('a');
if(b)alert('b');
if(c)alert('c');
if(d)alert('d');
if(e)alert('e');
if(f)alert('f');
if(h)alert(h);
if(g)alert(g);
}
false_show();
</script>
</HEAD>
<BODY>
</BODY>
</HTML>
typeof:返回数据的类型:它所产生的值:'number','string','boolean','undefined','function','object'
简单使用
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> typeOf </TITLE>
<script language="javascript">
var a ='';
var b = null;
var c = false;
var d ;
var e = 2;
var f = 'ddd';
var ff = function (){
alert();
}
var g = new Array();
alert(typeof(a));
alert(typeof(b));
alert(typeof(c));
alert(typeof(d));
alert(typeof(e));
alert(typeof(f));
alert(typeof(g));
alert(typeof(ff));
</script>
</HEAD>
<BODY>
</BODY>
</HTML>