I got this javascript exercise from my school. and I got this error. I don't understand what this error means.
Incorrect output: your program printed "20Invalid", but should have printed "20The" The webpage is asking for the user's age. The input value has already been fetched, but you have to fill in the missing code. When the page calls the function checkAge(), first print in the console "The input age: [age]", followed by one of the following, depending on the value:
18 years or more: "The user is an adult."
Under 18 years, but over 0 years: "The user is not yet an adult."
Otherwise: "Invalid input!"
function checkAge() { var age = document.getElementById("age").value; console.log("Input age: " + age); if (age <= 18 ){ console.log("The user is an adult."); } else if (0 <= age && age < 18){ console.log("The user is not yet an adult."); } else { console.log("Invalid input!"); } }