Skip to content
Advertisement

how to store the value of a key for a object and pass it to the function which is a value of another key in the same object

JavaScript

In the above object inside dateFilter for value i am using a calculateAverage function to get the value i need to pass the same value as parameter for calculatePercentage which is a value for percentage key in the same object how to store the calculateAverage at dateFilter and pass it to calculatePercentage so that i can avoid calculating average two times

Advertisement

Answer

To access the properties from within the object you can use getters.

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement