- Redux Quick Start Guide
- James Lee Tao Wei Suresh Kumar Mukhiya
- 70字
- 2021-07-02 12:40:28
Adding functions to objects and arrays
A variable can be added to any object. Since a function is stored in a variable, it can also be added to objects, as follows:
const myCalculator = {
bmi: (weight, height) => weight / (height * height)
};
Similarly, we can add it to an array, as follows:
const myCalculator = [
Bmi => (weight, height) => weight / (height * height)
];
推薦閱讀
- Learning Scala Programming
- Vue.js設(shè)計(jì)與實(shí)現(xiàn)
- Delphi程序設(shè)計(jì)基礎(chǔ):教程、實(shí)驗(yàn)、習(xí)題
- R語言經(jīng)典實(shí)例(原書第2版)
- Mastering Entity Framework
- HTML5 Mobile Development Cookbook
- ASP.NET Core 2 and Vue.js
- Learning Elixir
- Magento 2 Development Cookbook
- Visual C++串口通信技術(shù)詳解(第2版)
- Scratch 3.0少兒編程與邏輯思維訓(xùn)練
- Java Web基礎(chǔ)與實(shí)例教程
- INSTANT Django 1.5 Application Development Starter
- Gradle for Android
- Mastering JBoss Enterprise Application Platform 7