hai can anyone hep me to correct the code on using loop and function in BMI
<!DOCTYPE.html> <html> <body> <h1>loop and function</h1> <script> function BMIcalc() { var cat=""; var weight = prompt("Masukkan jumlah berat (kg) :"); var height = prompt("Masukkan jumlah tinggi (cm) :"); function operation(x,y) { //return w; //return h; var errMsg =""; if (w <= 0) } errMsg = errMsg +"* Weight cannot be negative \n"; } if (h <=0) { errMsg = errMsg +"* Height cannot be negative \n"; } if(errMsg != "") { alert(errMsg); } else { w = x*1 h = y/100 var BMI = (w/ (Math.pow(h,2))); //document.write("BMI: " +BMI.toFixed(2)); if (BMI < 16) { //document.write("BMI: " +BMI +"<br> Category: Severe Thinness </br>"); cat="Category: Severe Thinness"; } else if ((BMI >= 16) && (BMI <= 17)) { //document.write("BMI: " +BMI +"<br> Category: Moderate Thinness </br>"); cat="Category: Moderate Thinness"; } else if ((BMI >= 17) && (BMI <= 18.5)) { //document.write("BMI: " +BMI +"<br> Category: Mild Thinness </br>"); cat="Category: Mild Thinness"; } else if ((BMI >= 18.5) && (BMI <= 25)) { //document.write("BMI: " +BMI +"<br> Category: Normal </br>"); cat="Category: Normal"; } else if ((BMI >= 25) && (BMI <= 30)) { //document.write("BMI: " +BMI +"<br> Category: Overweight </br>"); cat="Category: Overweight"; } else if ((BMI >= 30) && (BMI <= 35)) { //document.write("BMI: " +BMI +"<br> Category: Obese Class I </br>"); cat="Category: Obese Class I"; } else if ((BMI >= 35) && (BMI <= 40)) { //document.write("BMI: " +BMI +"<br> Category: Obese Class II </br>"); cat="Category: Obese Class II"; } else{ //document.write("BMI: " +BMI +"<br> Category: Obese Class III </br>"); cat="Category: Obese Class III"; } { answer = input("Would you like to enter another? key y/n: ") while answer == "y": start() answer = None if answer == "n": exit() } output (BMI,cat) function output(x,y)