February 2019
Intermediate to advanced
204 pages
4h 52m
English
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)];
Read now
Unlock full access