js中boolean类型的理解

<html>
<head>

<script type="text/javascript">
        var x="12";
		alert(x+234);
		alert(typeof (x+234));
		var flag=false;  //true=1 false=0;
		alert(flag+34);
</script>
</head>
<body>
   String str="ere";
   int x= 123;
   str+x;
</body>  
</html>

在js中boolean类型的值有两个true和false

其中true=1;

false=0;

和c中的差不多;

posted @ 2016-05-13 00:19  lonecloud  阅读(2960)  评论(0编辑  收藏  举报
我的博客即将同步至 OSCHINA 社区,这是我的 OSCHINA ID:lonecloud,邀请大家一同入驻:https://www.oschina.net/sharing-plan/apply