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

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)));
主站蜘蛛池模板: 明溪县| 房产| 韶山市| 宾川县| 伊通| 博湖县| 酉阳| 靖州| 定边县| 达州市| 云安县| 桃江县| 南丰县| 徐汇区| 徐州市| 泽普县| 崇信县| 东乌| 永寿县| 黄冈市| 呼和浩特市| 延边| 广州市| 固阳县| 嘉兴市| 册亨县| 吉林省| 龙陵县| 平度市| 昆明市| 平山县| 乳山市| 海城市| 武冈市| 丰都县| 措勤县| 页游| 弋阳县| 枞阳县| 东方市| 普兰县|