Sometimes, we want to check if x greater than y and less than z with JavaScript.
In this article, we’ll look at how to check if x greater than y and less than z with JavaScript.
How to check if x greater than y and less than z with JavaScript?
To check if x greater than y and less than z with JavaScript, we can use an if statement.
For instance, we write:
const score = 5
if (score > 0 && score < 8) {
console.log(score);
}
We check if score
is bigger than 0 with score > 0
.
And we check if score
is less than 8 with score < 8
.
Since score
is 5, we see score
logged.
Conclusion
To check if x greater than y and less than z with JavaScript, we can use an if statement.