奇妙な理由で、このコード行は
この特定の行は
`Unexpected identifier`
bmr = 66 + ( 6.23 * weightInlbs ) + ( 12.7 heightInInches ) - ( 6.8 * age );
これがコード全体です
function metricComputation() {
var age = document.getElementById("age");
var weightInlbs = document.getElementById("weight");
var heightInInches = feetToInches(new Number(document.getElementById("heightinFt")) , document.getElementById("heightinIn"));
var bmr;
var gender = document.getElementById("gender");
if(gender === "male"){
bmr = 66 + ( 6.23 * weightInlbs ) + ( 12.7 heightInInches ) - ( 6.8 * age );
}
}
これがマークアップ全体です
<!DOCTYPE>
<html>
<head>
<script src="bmrcalc.js"></script>
</head>
<body>
<center>
<h1>Basal Metabolic Rate</h1>
Height: <input type = "text" id ="heightinFt"> ft <input type = "text" id = "heightinIn"> in <br>
Weight: <input type = "text" id ="weight">lbs<br>
Age: <input type = "text" id = "age"><br>
Gender:<select id = "gender">
<option value = "male">Male</option>
<option value = "female">Female</option>
<select> <br>
<button onclick = "metricComputation()">Compute</button>
<div id = "result"></div>
</center>
</body>
</html>