Advertisement
Guest User

Untitled

a guest
Apr 11th, 2023
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let height = document.querySelector("#height");
  2. let weight = document.querySelector("#weight");
  3. let resultButton = document.querySelector("#getResult");
  4. let index;
  5.  
  6. resultButton.addEventListener("click", () => {
  7.     index = Number(weight.value) / (Number(height.value) * Number(height.value));
  8.    
  9.     if (index <= 15.99) {
  10.         alert(`выраженный дефицит массы тела`);
  11.     }
  12.     else if (16 <= index <= 18.49) {
  13.         alert(`недостаточная (дефицит) масса тела`);
  14.     }
  15.     else if (18.50 <= index <= 24.99) {
  16.         alert(`норма`);
  17.     }
  18.     else if (25 <= index <= 29.99) {
  19.         alert(`избыточная масса тела (предожирение)`);
  20.     }
  21.     else if (30 <= index <= 34.99) {
  22.         alert(`1 степень ожирения`);
  23.     }
  24.     else if (35 <= index <= 39.99) {
  25.         alert(`2 степень ожирения`);
  26.     }
  27.     else {
  28.         alert(`3 степень ожирения`);
  29.     }
  30. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement