<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script>
var a = 66
var b = 77
var c = 88
var max ;
//思路第一部分对比a和b. 如果a大于b, 让a和c比. 如果a小于b, 让b和c对比谁大.
if(a>b){
if(a>c){
max = a ;
}else{
max = c ;
}
}else{
if(b>c){
max = b ;
}else{max = c ;}
}
document.write("max的值是:"+max) ;
</script>
</head>
<body>
</body>
</html>
用JavaScript比较三个数的大小 练习
最新推荐文章于 2022-10-18 09:26:52 发布