Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let height = document.querySelector("#height");
- let weight = document.querySelector("#weight");
- let resultButton = document.querySelector("#getResult");
- let index;
- resultButton.addEventListener("click", () => {
- index = Number(weight.value) / (Number(height.value) * Number(height.value));
- if (index <= 15.99) {
- alert(`выраженный дефицит массы тела`);
- }
- else if (16 <= index <= 18.49) {
- alert(`недостаточная (дефицит) масса тела`);
- }
- else if (18.50 <= index <= 24.99) {
- alert(`норма`);
- }
- else if (25 <= index <= 29.99) {
- alert(`избыточная масса тела (предожирение)`);
- }
- else if (30 <= index <= 34.99) {
- alert(`1 степень ожирения`);
- }
- else if (35 <= index <= 39.99) {
- alert(`2 степень ожирения`);
- }
- else {
- alert(`3 степень ожирения`);
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement