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

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)));
主站蜘蛛池模板: 三江| 石林| 阿克陶县| 青河县| 江达县| 文水县| 扎兰屯市| 台南县| 专栏| 名山县| 鹿邑县| 清丰县| 德惠市| 会理县| 屏边| 龙里县| 阿拉善右旗| 富川| 新绛县| 沙雅县| 泰顺县| 阜阳市| 北流市| 辽宁省| 荔波县| 志丹县| 博白县| 信宜市| 汉川市| 蒙山县| 邹平县| 宣化县| 济宁市| 惠水县| 昌平区| 密云县| 宜章县| 龙岩市| 上蔡县| 那曲县| 珠海市|