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

  • Redux Quick Start Guide
  • James Lee Tao Wei Suresh Kumar Mukhiya
  • 82字
  • 2021-07-02 12:40:28

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)));
主站蜘蛛池模板: 延寿县| 富川| 青海省| 岫岩| 丹棱县| 昂仁县| 潞城市| 南丰县| 铜鼓县| 鹤岗市| 松江区| 汤原县| 香港| 新沂市| 台州市| 泗阳县| 辉南县| 绍兴县| 阿拉尔市| 宜州市| 庆城县| 招远市| 福海县| 香港| 河曲县| 崇礼县| 察隅县| 金塔县| 威远县| 繁峙县| 安远县| 广南县| 新乡县| 拜泉县| 蕲春县| 大化| 乌兰察布市| 涞源县| 灵宝市| 英超| 平顶山市|