- 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)));
推薦閱讀
- LabVIEW2018中文版 虛擬儀器程序設(shè)計(jì)自學(xué)手冊(cè)
- Spring技術(shù)內(nèi)幕:深入解析Spring架構(gòu)與設(shè)計(jì)
- DevOps入門與實(shí)踐
- 數(shù)據(jù)結(jié)構(gòu)與算法JavaScript描述
- Linux環(huán)境編程:從應(yīng)用到內(nèi)核
- Python忍者秘籍
- Mastering Unity 2D Game Development(Second Edition)
- Regression Analysis with Python
- Mastering HTML5 Forms
- Microsoft HoloLens By Example
- 從零開(kāi)始學(xué)Unity游戲開(kāi)發(fā):場(chǎng)景+角色+腳本+交互+體驗(yàn)+效果+發(fā)布
- Java程序設(shè)計(jì)入門(第2版)
- Getting Started with RethinkDB
- LabVIEW數(shù)據(jù)采集(第2版)
- HTML5 and CSS3:Building Responsive Websites