<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>JS基础</title>
<script type="text/javascript">
var a,b,sum;
var a = 5;
var b = 100%7;
sum = a > b && a*b > 0 ;
document.write( "我认为 a 的值是:" +5+ " b的值是:" +2+ "sum 的值是:" +true+"<br/>");
document.write( "答案是,第一轮计算后,a 为:"+ a +";b为:"+b +";第一次计算sum为:"+ sum +"<br/>");
sum = ( (++a) + 3 ) / (2 - (--b) ) * 3;
document.write( "再一次计算后,我认为 a 的值是:" +6+ " b的值是:"1+ "sum 的值是:" +27+"<br/>");
document.write( "答案是,第二轮计算后,a 为:" + a + ";b为:" + b +";第二次计算sum为:"+ sum +",sum的类型也发生变化了。");
</script>
</head>
<body>
</body>
</html>
document.write( "再一次计算后,我认为 a 的值是:" +6+ " b的值是:"1+ "sum 的值是:" +27+"<br/>");
这一行数字1的前面少了个加号。
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>JS基础</title>
<script type="text/javascript">
var a,b,sum;
var a = 5;
var b = 100%7;
sum = a > b && a*b > 0 ;
document.write( "我认为 a 的值是:" +5+ " b的值是:" +2+ "sum 的值是:" +true+"<br/>");
document.write( "答案是,第一轮计算后,a 为:"+ a +";b为:"+b +";第一次计算sum为:"+ sum +"<br/>");
sum = ( (++a) + 3 ) / (2 - (--b) ) * 3;
document.write( "再一次计算后,我认为 a 的值是:" +6+ " b的值是:"1+ "sum 的值是:" +27+"<br/>");
document.write( "答案是,第二轮计算后,a 为:" + a + ";b为:" + b +";第二次计算sum为:"+ sum +",sum的类型也发生变化了。");
</script>
</head>
<body>
</body>
</html>