I wanna put the check (if) before user can type his name, but it doesn't work. I can still put numbers in the input. What's wrong?
var name1 = prompt('enter name');
var surname = prompt('enter surname');
var patronymic = prompt('enter secondname');
var fullName = name1 + " " + surname + " " + patronymic;
if (typeof(name1) === "number" || typeof(surname) === "number"|| typeof(patronymic) === "number") {
do {
alert('wrong, try again');
name1 = prompt('enter name');
surname = prompt('enter surname');
patronymic = prompt('enter ');
}
while (typeof(name1) === "string" && typeof(surname) === "string" && typeof(patronymic) === "string");
}
alert("U " + fullName);