0

I am trying to write a function to calculate the Basal Metabolic Rate. As you can see in the function, I need parenthesis around some of the calculations. But every time I save the file, the parenthesis are removed, as you can see in the code below. How can I prevent this? Also, please note I am working on a team so I don't think I should be playing around with the Prettier. ( I am using React and Typescript.)

Actual Function: Calculate Basal Metabolic Rate

Men: BMR = 88.362 + (13.397 x weight in kg) + (4.799 x height in cm) – (5.677 x age in years)

Women: BMR = 447.593 + (9.247 x weight in kg) + (3.098 x height in cm) – (4.330 x age in years)

Code:

 function handleSubmit(event: any) {
    event.preventDefault();
    if (male) {
      const newGeb = 88.362 + 13.397 * Number(peso) + 4.799 * Number(altura) - 5.677 * Number(edad);
      setGeb(newGeb);
    } else if (female) {
      const newGeb = 447.593 + 9.247 * Number(peso) + 3.098 * Number(altura) - 4.33 * Number(edad);
      setGeb(newGeb);
    }
    setIsGebModalOpen(true);
    event.target.reset();
  }

0 Answers0