Boolean Logic
A boolean is a true/false value. Comparisons like >= produce booleans, and
you can combine them with logical operators: && (and β both must be true),
|| (or β either one), and ! (not β flips it).
age >= 18 && hasTicket; // true only if BOTH hold
age < 13 || age > 65; // true if EITHER holds
Your task
Write canVote(age, isCitizen) that returns true only when age is at
least 18 and isCitizen is true.
β‘ 25 XP
π§± Code blocks
Drag a block into the editor, or tap it to drop it in where your cursor is. Add them in order to build your answer.
solution.jsRuns in your browser
Loading editorβ¦
Tests3 to pass
adult citizen
too young
not a citizen
Run your code to check these.