canVote

Easy · Conditionals · 3 test cases

Given a person's age, determine if they are old enough to vote. The voting age is 18.

Examples

canVote(25) → true
canVote(17) → false
canVote(18) → true

Starter code

function canVote(age) {

}

Complexity of the optimal solution

Time O(1), space O(1). This function performs a single comparison, which is a constant time operation.

Solve canVote in the browser