| 18 | |
| 19 | //DESCRIPTION ACCORDING TO BMI CATEGORY |
| 20 | function checkCategory(value){ |
| 21 | if(isFinite(value)){ |
| 22 | if(value >= 30.0){ |
| 23 | bmiCategoryElem.style.color = '#b00'; |
| 24 | bmiElem.style.color = '#b00'; |
| 25 | bmiElem.style.borderColor = '#b00'; |
| 26 | return `Obese`; |
| 27 | }else if(value >= 25.0 && value <= 29.9){ |
| 28 | bmiCategoryElem.style.color = '#8a4f02'; |
| 29 | bmiElem.style.color = '#8a4f02'; |
| 30 | bmiElem.style.borderColor = '#8a4f02'; |
| 31 | return `Overweight`; |
| 32 | }else if(value >= 18.5 && value <= 24.9){ |
| 33 | bmiCategoryElem.style.color = '#2ca1bc'; |
| 34 | bmiElem.style.color = '#2ca1bc'; |
| 35 | bmiElem.style.borderColor = '#2ca1bc'; |
| 36 | return `Normal`; |
| 37 | }else if(value <= 18.4) { |
| 38 | bmiCategoryElem.style.color = '#625301'; |
| 39 | bmiElem.style.color = '#625301'; |
| 40 | bmiElem.style.borderColor = '#625301'; |
| 41 | return `Underweight`; |
| 42 | } |
| 43 | }else { |
| 44 | bmiCategoryElem.style.color = 'black'; |
| 45 | return ``; |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | //UPDATING UI |
| 50 | function updateUI(){ |