How can I iterate an array and take first five value as key of Object and all the other values as Object value. For an example : I have an array Like this
["name", "time", "date", "address", "Balance", "George", "Nancy", "Shivam", "George", "10:00AM", "12:00PM", "4:00PM", "", "10/10/2021", "05/20/2021", "06/05/2019", "07/10/2021" ,"308 E Parker St", "505 10th Ave", "2706 Pershing Blvd" , "988 Cannon Farm Rd", "546.00", "648.00", "899.99", ""]
I want something like this:
[{name : "George", time : "10:00AM", date: "10/10/2021", address :308 E Parker St", Balance : "546.00" }, {name : "Nancy", time : "12:00PM", date: "05/20/2021", address: "505 10th Ave", Balance : "648.00" }, {name : "Shivam", time : "4:00PM", date: "06/05/2019", address: "2706 Pershing Blvd", Balance : "899.99" }, {name : "George", time : "", date: "07/10/2021", address: "988 Cannon Farm Rd", Balance : "" } ]
how I can separate the name, time date and others values from the given array since the values are dynamic.