Respiration rate, also known as breathing rate, is the number of breaths a person takes per minute. It's a vital sign that indicates how well your body is functioning. A normal resting respiration rate for an adult is typically between 12 and 20 breaths per minute. Factors like age, activity level, illness, and certain medications can affect this rate.
function calculateRespirationRate() {
var breathsInput = document.getElementById("breaths");
var timeInput = document.getElementById("timeInSeconds");
var resultDiv = document.getElementById("result");
var breaths = parseFloat(breathsInput.value);
var timeInSeconds = parseFloat(timeInput.value);
if (isNaN(breaths) || isNaN(timeInSeconds) || timeInSeconds <= 0) {
resultDiv.innerHTML = "Please enter valid numbers for breaths and time (time must be greater than 0).";
return;
}
var breathsPerMinute = (breaths / timeInSeconds) * 60;
resultDiv.innerHTML = "