I have some troubles with the console's output when I try to run some snippet js code from the "source" tab. Instead of getting a valid output, I get "undefined" (I've checked the code in JSFiddle and it's correct the output is:20 )
Why does it happen and how can I resolve it?
JS:
//Create your function below this line.
//The first parameter should be the weight and the second should be the height.
function bmiCalculator(weight, height){
return Math.round(weight/Math.pow(height,2));
}
/* If my weight is 65Kg and my height is 1.8m, I should be able to call your function like this:
var bmi = bmiCalculator(65, 1.8);
bmi should equal 20 when it's rounded to the nearest whole number.
*/
var bmi = bmiCalculator(65, 1.8);
console.log(bmi);