A person can Vote or not using JavaScript

<script>
function canVote(age)
{
if (age >= 18)
{
return " Eligible to vote. " ;
} else
{
return " Not eligible to vote. " ;
}
}

let age = prompt( " Enter your age: " );
let result = canVote(age);
alert(result);
</script>