I know to convert array to object, we use
var object = Object.assign({}, array);
I get an array from multiple select input. like this
var patterns = array["pattern1", "pattern2", "pattern3"];
Then after using object.assign I get object like this.
patterns = {
0: pattern1,
1: pattern2,
2: pattern3
}
I want to add more properties and values to the object values like this:
patterns = {
0:{
name: pattern1,
status: 0
},
1:{
name: pattern2,
status: 0
}
}
How can I achieve this?
array["pattern1", "pattern2", "pattern3"];?patterns.map( i => { name: i, status: 0 } )