Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

150
Vistas
Window(confirm) looping to first function on response

Sorry im new to this website I'm trying to make my window(confirm) prompt when a user clicks okay it will loop back to the first function is this possible? How would I do this?

function fn() {
    let firstName="";
    while(firstName==""){
        firstName = prompt("Enter your first name:");
    let lastName="";
        while(lastName==""){
        lastName = prompt("Enter your Last name:");
        let gender="";
    while(gender !== "Male" && gender !== "Female" && gender !== "m" && gender !== "f"){
        gender = prompt("Male or Female?");
    let ageYrs="";
        while(ageYrs < 15 ||ageYrs > 100|| isNaN(ageYrs) == true){
        ageYrs = prompt("What is your age?");
         let pCode="";
        while(pCode === '' || pCode.length <4 || pCode === null){
        pCode = prompt("What is your postcode?");
    let emplyStat="";
        while(emplyStat !== "Employed" && emplyStat !== "Unemployed" && emplyStat !== "unemployed" && emplyStat !== "employed"){
        emplyStat = prompt("Are you employed or unemployed?");
        }  
        }
        }   
        }   
        }
        }   
    return firstName;
        } 
    firstName = fn();

if (confirm("Press a button!")) {
  txt = "You pressed OK!";
} else {
  txt = "You pressed Cancel!";
}
   
}
about 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda