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

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)));
主站蜘蛛池模板: 平利县| 财经| 永城市| 桐梓县| 衡南县| 县级市| 甘洛县| 桃园县| 定陶县| 宝兴县| 辽中县| 静宁县| 凌源市| 东城区| 休宁县| 遂川县| 田林县| 鲜城| 泰顺县| 鸡东县| 上思县| 太谷县| 武安市| 资源县| 姜堰市| 岳阳市| 彩票| 延寿县| 垣曲县| 宣城市| 长丰县| 虞城县| 康平县| 元谋县| 百色市| 古田县| 汝阳县| 南川市| 基隆市| 南江县| 深水埗区|