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

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)
];
主站蜘蛛池模板: 隆尧县| 姜堰市| 临潭县| 定陶县| 华安县| 神池县| 沁源县| 阿克陶县| 乌兰县| 晴隆县| 长垣县| 沂源县| 阿巴嘎旗| 巴楚县| 百色市| 太和县| 崇礼县| 宜州市| 宜君县| 罗源县| 平陆县| 蕲春县| 开远市| 浑源县| 唐河县| 博湖县| 渑池县| 宣威市| 永宁县| 维西| 临安市| 谷城县| 乐山市| 陕西省| 博湖县| 赤壁市| 社旗县| 正蓝旗| 广宗县| 洪雅县| 墨竹工卡县|