<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<title></title>

</head>

<body>

<script type="text/javascript">

/*

三元运算符的例子

if(exp){

exp为true的代码段;

}else{

exp为false的代码段;

}

exp1?exp2:exp3;

*/

if(3>1){

document.write('aa');

}else{

document.write('bb');

}

document.write('<br/>');

var res=3>1?'aa':'bb';

document.write(res);

document.write('<br/>');

var x=0/0;

var x=123;

res=isNaN(x)?0:x;

alert(res);

</script>

</body>

</html>