QUESTION IMAGE
Question
write an if statement that displays \ok\ if userage is between 10 and 20 inclusive.
1 let userage = 12; // your code will be tested with multiple values, not just 12.
2
3 / your solution goes here /
4
Step1: Check if userAge is greater than or equal to 10
Use the condition userAge >= 10
Step2: Check if userAge is less than or equal to 20
Use the condition userAge <= 20
Step3: Combine the two conditions with a logical AND
Use && to combine the two conditions. So the full if statement is if (userAge >= 10 && userAge <= 20) { console.log("OK"); }
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
if (userAge >= 10 && userAge <= 20) { console.log("OK"); }