use a conditional to check greater than number in Javascript
Code snippet on how to use a conditional to check greater than number in Javascript
if (number > 10) {
console.log("Number is greater than 10");
} else {
console.log("Number is not greater than 10");
}
This code uses a conditional to test if a given number is greater than 10. First, the if
statement checks if the number provided is greater than 10. If that evaluates to true, the code prints to the console “Number is greater than 10”. If the condition evaluates to false, the code moves to the else
statement and prints to the console “Number is not greater than 10”.