I have this array and a variable:
const a = [1, 5, 3]
const model = 'Audi'
I want on object like that:
const obj = {
data: {
0: 1,
1: 5,
2: 3,
},
cars: {
0: 'Audi',
1: 'Audi',
2: 'Audi',
},
}
I can I do that?
I think I can use a for. This is what I think to do:
const obj = {}
for(let i = 0; i < a.lenght; i++) {
obj.cars =
}
I don't know ho to complete the code... and I don't think is the best solution.
Thanks
forEachfunction