范围检查
确保值不超过特定范围。例如,当您要检查温度是否在 97.8 ° F 到 99.1 ° F 之间时。
示例 3-4 温度范围检查
在本例中,我们正在寻找超出特定范围的温度。
//validate if a given a temperature (temp_f) is outside of a specified range
var upper = 99.1;
var lower = 97.8;
if (temp_f > lower && temp_f < upper){
return false;
}
父主题:一般表达式