Add an attribute and default value to each element in the array
Below is the code
var articlelist = []
articleArr.map(((item, index) => {
articlelist.push(Object.assign({}, item, {
state: false,
opened: '+'
}))
}))
Result: All the elements in the articleArr array are copied to the articlelist array, and the state attribute with a value of false and the opened attribute with a value of '+' are added.