Hi, How may add a new properties in array objets
Well what I want to do is I can add a new property so that I can read the template from the MDBTABLE
i have the next example
const instutions = [
{
name: 'Malasia',
direction: 'Asia'
},
{
name: 'New Francia',
direction: 'paris'
}
];
well now, i would like add new properties and result It would be something like this
const instutions = [
{
name: 'Malasia',
direction: 'Asia',
buttonAdd: 'Hello world'
},
{
name: 'New Francia',
direction: 'paris',
buttonAdd: 'Hello world'
}
];
Well add new properties, object array, you could do something like this
You can add a property in many ways. The higher-order function map
is one of them. See the example.
const institutions = [{name: 'Malasia',direction: 'Asia'},{name: 'New Francia',direction: 'paris'}];
institutions.map(el => el.new_property = 'Hello')
console.log(institutions)