JS:Boolean

Boolean数据类型:

有两个值:true false

 

Boolean会把不是Boolean的值变为Boolean值

 

var a = 1;
var b = true;
var c = 0;
var d = "0";
var e = "1";
var f = "";
var g = [0];
var h = [[]];
var i = {};
document.write(a==b);    //true
document.write(c==b);    //false
document.write(d==b);    //false
document.write(e==b);    //true
document.write(f==b);    //false
document.write(g==b);    //false
document.write(h==b);    //false
document.write(i==b);    //false

仍有例子有待补充......

posted on 2022-06-14 09:20  香香鲲  阅读(67)  评论(0编辑  收藏  举报