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

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)
];
主站蜘蛛池模板: 玛沁县| 微博| 藁城市| 盘锦市| 新巴尔虎右旗| 灌云县| 漳浦县| 龙泉市| 乌兰浩特市| 新巴尔虎左旗| 格尔木市| 当雄县| 南川市| 清水河县| 通海县| 肇源县| 罗平县| 桓台县| 乐亭县| 丹寨县| 武鸣县| 巴林右旗| 海伦市| 闵行区| 内黄县| 丹寨县| 庆元县| 克东县| 庆安县| 鄂伦春自治旗| 曲阜市| 玉树县| SHOW| 固阳县| 巩留县| 太仓市| 从化市| 永州市| 梅州市| 宣城市| 仙居县|