I have a problem that how to keep show a prompt until user enter their birth year is always smaller than the current year. Here is my code I try using loop but now i struggle. I hope someone can help me, I appreciate it.
<body>
<p id= "age"></p>
<button onclick=" notify()">Try it</button>
<script>
function notify(){
let age = prompt("Your birth year");
const year = new Date().getFullYear();
do {
document.getElementById("age").innerHTML =
age + " is a good year";
} while (age < year && age != null);
}
</script>
</body>