I want to make few tables from an Array using dropdown list. List will be Daily, weekly, Monthly, yearly.
I have written the code. Below is the sample array.
var allPoints = records.map(
(
{ id, sector_name, f_day_lot1, f_day_lot2, f_day_lot3, f_day_lot4 }
) => (
{ id, sector_name, f_day_lot1, f_day_lot2, f_day_lot3, f_day_lot4 }
)
);
The thing is I want to change the above day to weekly, monthly or yearly depends on the dropdown.
I can write same code for multiple times changing day to weekly, monthly or yearly. But then it will be alot of code. So, is there any other better way to do.
Or how to make day as a variable and change value depending upon menu.
daystate known everytime?