I working on a Daily Planner/Organiser. I have a few seperate arrays with event information such as Event, Date, Venue, Start Time, End Time etc. All the information for an associated event is in these seperate arrays. How can I pull them all together and push them into a single array (MasterArray) with key pair? Is that possible? I was trying the below function but I can't get it to work
var Event = ["class","party"];
var Date = ["2/3/2020","16/5/2020"];
var StartTime = ["9","11"];
var EndTime = ["10","15"];
var ApptVenue = ["Classroom","Arcade"];
function Push() {
var MasterArrayLen = Event.length;
var MasterArray= [];
for (let i = 0; i < MasterArrayLen; i++) {
MasterArray.push({
"Event": Event .shift(),
"Date": Date .shift(),
"Start": StartTime .shift(),
"End": EndTime .shift()
});
}
Dateis a class in javascript. Probably want to avoid naming your variables that. In general, variables should start with lowercase letters to avoid such things.Push()or returning the master array from it