So, I'm creating a table on which the users will fill out the table's header with their options. For this example let's say I want to create 3 headers as options: "fruits", "desserts" and "others".
The "applicants" will fill their answers for those headers.
The problem I'm trying to solve is the following: I need to sort those answers, and I had the idea to use the header as the variable of the array, and I'd fill that array with the answer, like:
let fruits = [];
fruits.push(*applicant's answers*);
I can create an array with the headers after the table is ready to be filled, like "headers = [fruits, desserts, others]" but I don't know how to create the "fruits = []" or "desserts = []", as I don't know the headers until the table is filled and ready to be answered.
Is there a way to solve this or I'll need to sort it out in an another way?