- 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)));
推薦閱讀
- UML和模式應(yīng)用(原書第3版)
- Oracle Exadata性能優(yōu)化
- JavaScript修煉之道
- Java EE框架整合開發(fā)入門到實(shí)戰(zhàn):Spring+Spring MVC+MyBatis(微課版)
- Dependency Injection in .NET Core 2.0
- C/C++常用算法手冊(第3版)
- Reactive Programming With Java 9
- Magento 1.8 Development Cookbook
- 51單片機(jī)C語言開發(fā)教程
- Python:Deeper Insights into Machine Learning
- R Data Science Essentials
- 交互式程序設(shè)計(第2版)
- QlikView Unlocked
- SSH框架企業(yè)級應(yīng)用實(shí)戰(zhàn)
- OpenCV 3.0 Computer Vision with Java