Search⌘ K
AI Features

Exercise 1: Let's Vote

Explore how to write a JavaScript function that determines voting eligibility based on age input. Learn to handle different data types and conditions while avoiding common coding pitfalls in JavaScript. This exercise helps improve your problem-solving and coding skills in realistic scenarios.

We'll cover the following...

Problem statement

In this exercise, you have to write a function named canVote() that takes age as a parameter and returns a string, as shown in the following example calls to the function: ...