“x是否大于y且小于z"的表达式? [英] Expression for "is x greater than y and less than z"?
本文介绍了“x是否大于y且小于z"的表达式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试测试一个数字是否大于 0 但小于 8.我如何在 JavaScript 中做到这一点?
I'm trying to test if a number is greater than 0 but less than 8. How do I do that in JavaScript?
这就是我正在尝试的:
if (score > 0 < 8) { alert(score); }
推荐答案
代码如下:
if (score > 0 && score < 8){
alert(score);
}
附言这与 jQuery 无关.很简单,裸 JavaScript!
P.S. This has nothing to do with jQuery. It's simple, naked JavaScript!
这篇关于“x是否大于y且小于z"的表达式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文