标签:运算符 tab number html 三元运算符 var ble OLE rip
<script> | |
var a = 4; | |
var b = 5; | |
//如果a<b输出a-b的结果 否则输出b-a的结果 | |
var c = (a < b) ? (a - b) : (b - a); | |
console.log(c); | |
var age = 20; | |
//如果年龄满18岁就输出成年人,否则输出未成年 | |
var age = 2; | |
var d = (age >= 18)?‘成年人‘:‘未成年‘; | |
console.log(d); | |
</script> |
标签:运算符 tab number html 三元运算符 var ble OLE rip
原文地址:https://www.cnblogs.com/zhangao/p/9796862.html