...

/

Solution Review: Let's Vote

Solution Review: Let's Vote

Learn how to solve the problem in the previous lesson.

We'll cover the following...

Solution

Run the code below to see the output.

Press + to interact
'use strict';
const canVote = function(age) {
if(age === 18) {
return 'yay, start voting';
}
if(age > 17) {
return "please vote";
}
return "no, can't vote";
};
console.log(canVote(12));
console.log(canVote("12"));
console.log(canVote(17));
console.log(canVote('@18'));
console.log(canVote(18));
console.log(canVote(28));
...
Access this course and 1400+ top-rated courses and projects.