I have a simple a HTML document with a script tag, I'm messing around with a try catch and can't get the while statement in the catch block to work. The try and catch simply runs as if the while block isn't there.
try {
let age = prompt("age?")
if (age <= 0 || age >= 120) {
throw new Error("Something Happened!")
}
} catch (e) {
let state = true;
while (state) {
age = prompt("age?");
if (age > 0 || age < 120) {
state = false;
}
}
}