FIT100
Function Features (cont.)
•Scope of Reference … refers to where in the program a variable is “known,” i.e. where its value can be referenced and/or assigned
function bmiE ( weight, heightIn ) {
  // Figure BMI in English
  var heightFt = heightIn / 12; // Change to feet
  return 4.89 * weight / (heightFt * heightFt);
}
function BMI (units, height, weight ) {
   // Compute BMI
   if (units == "English")
      return bmiE(weight, height);
   else
      return bmiM(weight, height);
}
Local to function