How can I obtain something like this:
items = [{
value: 'All',
checked: false
}, {
value: 'a',
checked: false
}, {
value: 'b',
checked: false
}, {
value: 'c',
checked: false
}];
eg.: console.log(items[2].value)='b'
where 'a', 'b', 'c' .. come from an array arr = ['a', 'b', 'c', 'd', 'e', ...]
I tried with a for
for (var i = 0; i < arr.length; i++) {
items=[
{value: 'All', checked: false},
{value: arr[i], checked: false}
]
}
but this is not working and I have no other idea. Is there another way to obtain this? Thank you for your time!
Allproperty in each loop iteration.