-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
37 lines (26 loc) · 845 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
var height = document.querySelector('#height').innerText;
var weight = document.querySelector('#weight').innerText;
function calculate(height,weight) {
var new_height = document.querySelector('#height').value;
var new_weight = document.querySelector('#weight').value;
var div_height = new_height/100
var sqr_height = (div_height*div_height);
var bmi = new_weight/sqr_height;
var ans = Math.round(bmi*10)/10;
// var fd = ans+'
var rem = document.querySelector('#ans').innerHTML = ans;
let result = document.querySelector('#ans')
if (isNaN(ans)){
$('#ans').css('display','none');
// console.log(fd);
}else{
// fd = rem+' kg/m2';
$('#ans').css('display','initial');
$('span').css('display','initial');
// return rem;
return rem;
// console.log(rem);
}
}
calculate(height,weight);
// console.log(rem);