<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>hello world</title>
</head>
<body>
<script type="text/javascript">
window.onload= function myf(){
var a=5>2;
var b=2;
var c=3;
var Max=a?b:c;
alert(Max)//1.如果a的值为true,计算b的值,运算结果为b的值; 2.否则,计算c的值,运算结果为c的值。
}
</script>
</body>
</html>
结果会弹出2