Lo siento, soy nuevo en este sitio web. Estoy tratando de hacer que mi ventana (confirmar) solicite cuando un usuario hace clic en Aceptar, volverá a la primera función, ¿es esto posible? ¿Cómo haría esto?
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!"; } }