- 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)));
推薦閱讀
- Mastering Yii
- Android程序設計基礎
- Java:High-Performance Apps with Java 9
- PySide 6/PyQt 6快速開發與實戰
- 軟件測試實用教程
- 學習OpenCV 4:基于Python的算法實戰
- PHP從入門到精通(第4版)(軟件開發視頻大講堂)
- JavaScript應用開發實踐指南
- JBoss:Developer's Guide
- Qt5 C++ GUI Programming Cookbook
- Java Web應用開發項目教程
- C#程序設計基礎入門教程
- Mastering PowerCLI
- Java程序設計實用教程(第2版)
- 從零開始構建深度前饋神經網絡:Python+TensorFlow 2.x