I want to create an array of object like this :
array_1 :
array(0, 0, 0, 1, 0, 1, 0, 1, 1);
object_2 :
obj: [
{
id: 0,
fonction: 'hey'
},
{
id: 1,
fonction: 'hi'
}
]
So, I want the following output :
result :
obj: [
{
id: 0, // id of object_2
max: 5, // number of id value in array_1
value: 0, // add an empty value
fonction: 'hey' // fonction text in oject_2
},
{
id: 1,
max: 4,
value: 0,
fonction: 'hi'
}
]
Thanks for your help