亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

JavaScript ?? ??

JavaScript Boolean Object

Boolean ??? Boolean ????? ??, ? ??? ??? ? ?? ??? ?(true)? ??(false)? ????? ????. ?? ??? ???? ??? ??? ????.

//Constructor
new Boolean(value);
//Conversion function
Boolean(value);

value ????? ??? ?? ? ????. ?? ????? ?? ??? ??? ?? ? ????. ? ? ??? ???? ?? ??? ?? ??? ? ????.

<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8"> 
<title>php中文網(wǎng)(php.cn)</title> 
<script type="text/javascript">
    document.write( typeof(new Boolean(1)) + '<br />' );
    document.write( typeof(Boolean(1)) );
</script>
</head>
<body>
</body>
</html>

? ??? ???? ??? ??? ????.

object
boolean


???? ???? ?? ? ? ????. (? ?? ??)? ?? ?? ???? ??? ?????. ?? ??? ???? ?? ?? ????.

??: Boolean ??? Boolean ?? ?? ????? ??? ? ?? ??? ??? ?????.

Tips

? ????? 0, -0, null, "", false, unundefined ?? NaN?? ????? ????? ??? ?? Boolean ??? false? ????, ??? ??? true???. .

Boolean ??? false? ???? ??? if ???? ??? true???.

<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8"> 
<title>php中文網(wǎng)(php.cn)</title> 
<script type="text/javascript">
var obj1 = new Boolean(false);
if( obj1 ){
document.write( '1' );
}else{
document.write( '2' );
}
</script>
</head>
<body>
</body>
</html>

? ??? ???? 1? ?????. ? ??? obj1? false? ??? ????? ???? if ?? ? obj1? ?? ?? ?? ????? ??? ?? ??? ???? true? ???? ??? ???? ????. ?? obj1 ??? ??? ?? ??? ?? ??? ????.

???? ??
||
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> <script type="text/javascript"> var b1=new Boolean(0); var b2=new Boolean(1); var b3=new Boolean(""); var b4=new Boolean(null); var b5=new Boolean(NaN); var b6=new Boolean("false"); document.write("0 is boolean "+ b1 +"<br>"); document.write("1 is boolean "+ b2 +"<br>"); document.write("An empty string is boolean "+ b3 + "<br>"); document.write("null is boolean "+ b4+ "<br>"); document.write("NaN is boolean "+ b5 +"<br>"); document.write("The string 'false' is boolean "+ b6 +"<br>"); </script> </head> <body> </body> </html>