Help! Im in conclusion section and Im trying to make a statement if a var = to a letter {its an error }


#1

So im trying to make a program that helps you make a resume for entering a pro esports team. This is what I have so far:

confirm("This is a resume designed for entering Pro LoL teams. I'll be asking you a series of question and at the end there will be a printed resume completed with all the information the team will need.")
var name = prompt("Write your full name with your IGN. Example: Axel 'The Mexigore' Castrejon ")
var age = prompt("What's your age? Example: do you really need an example for this?")
if (age === "yes" ) {
    age = prompt("Fine. Exmaple: 18. Now answer the question") 
} 
if (age > 100 || age < 0 ) { 
    age = prompt("Answer the question already. What's your age?")
}
var age16warning





if (age <= 16) {
    age16warning = " (WARNING: Most teams will requiere you to be over the age of 16.)"
} 

console.log(name)
console.log(age)

But im stuck with somethng "if (age > 100 || age < 0)..."
As you can see it will check if the number is lower than 0 or higher than 100 just so people don't "troll the system", its not like it will be a huge problem since they are the ones using the program for a reason but I just wanted them not to be able to write anything but number and I though this would work fro some reason (just for clarification i want the if statement to check if the input is equal to a number)
PSA: if there is a grammar error be sure to tell me so i can fix it


#2

The second if testing age needs to be an else if statement.

You also need an else statement after, if neither of those are satisfied, and they properly answered with a correct age.


#3

i want the if statement to check if the input is equal to a number

For checking is integer

var num = 12;
console.log(Number.isInteger(num));

For checking is not a number you can use isNaN();

num is not neagtiv you have a good way to check it ( num < 0 )


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.