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

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)
];
主站蜘蛛池模板: 吉安县| 涿鹿县| 奉贤区| 紫云| 唐海县| 平陆县| 高密市| 长沙县| 南充市| 沅陵县| 栾川县| 旌德县| 九台市| 乐亭县| 眉山市| 六盘水市| 绥宁县| 邯郸县| 炉霍县| 扎赉特旗| 崇礼县| 吉安市| 视频| 台南县| 建水县| 确山县| 呼和浩特市| 霍州市| 樟树市| 金阳县| 西吉县| 余江县| 麟游县| 临邑县| 东至县| 陕西省| 古浪县| 金寨县| 邓州市| 达州市| 宜川县|