官术网_书友最值得收藏!

Functions as arguments

Functions can be used as arguments for other functions. Let's use the preceding bmi function to check whether a person has an obesity issue. According to the BMI scale, someone with a bmi between 30.0 and 54 is said to have obesity. We will pass a function as an argument, as follows:

const bmi = (weight, height) => weight / (height * height);
const hasObesity = (bmi) => bmi >= 30.0 && bmi <=54;
console.log(hasObesity(bmi(100, 2.2)));
主站蜘蛛池模板: 文水县| 石家庄市| 株洲市| 军事| 开远市| 大姚县| 浮梁县| 保定市| 孝昌县| 霍林郭勒市| 东海县| 安泽县| 金昌市| 象山县| 永昌县| 太仓市| 普安县| 扎赉特旗| 贵南县| 怀宁县| 柘城县| 九龙县| 阿拉善左旗| 莱西市| 金沙县| 洛阳市| 全州县| 毕节市| 藁城市| 克什克腾旗| 长岛县| 喀什市| 南华县| 喜德县| 珠海市| 南木林县| 绥化市| 介休市| 奉新县| 灌云县| 祁连县|