const students = ['John', 'Mark'];
const weight = [92, 85]
const height = [1.88, 1.76]
function yourBodyMass(name, funct, mass, height) {
console.log(`${name}, your body mass index is ${funct(mass, height)}.`)
}
function calculateBMI(mass, height) {
const BMI = mass / height ** 2;
return BMI;
}
function loopStudents() {
for (let i of students) {
return yourBodyMass(students[i], calculateBMI)
}
}
Is it possible to loop through the students array without having to declare the yourBodyMass function repeatedly? Please let me know.