Skip to content

Commit bb58640

Browse files
committed
feat: notify under 18 users calc can't be used
1 parent a73bc18 commit bb58640

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

main.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@ const underageBtn = document.createElement("button");
1414
underageBtn.textContent = "No, I am under 18";
1515
document.body.append(underageBtn);
1616

17+
underageBtn.addEventListener("click", ()=> {
18+
document.body.innerHTML = "";
19+
20+
const underageMessage = document.createElement("p");
21+
underageMessage.textContent = `
22+
This BMI calculator is designed for adults (18 years and older).
23+
For children and teenagers, BMI is calculated differently.
24+
Please consult a pediatric or health professional for accurate guidance.
25+
`;
26+
document.body.append(underageMessage);
27+
});
28+
1729
function bmiCalculator (weight, height) {
1830
const bmi = (weight / ((height / 100) ** 2)).toFixed(1);
1931

0 commit comments

Comments
 (0)