jeudi 30 juillet 2020

What is the best way to ask a string prompt into a number? [duplicate]

What I was able to find while looking through stackoverflow was that this is the best way to prompt a string and turn it into a number. Is this the best way? Thank you!

var age = prompt("Please enter your age:");
if (Number(age) < 18) {
  alert("");
}

Aucun commentaire:

Enregistrer un commentaire