I am working with an array of objects like this:
array = [
{name: 'name'},
{name: 'name'},
{name: 'name'},
{name: 'name'},
]
My goal is to add a key called '123' to each object in the array, so it should look like this:
array = [
{name: 'name', key: '123'},
{name: 'name', key: '123'},
{name: 'name', key: '123'},
{name: 'name', key: '123'},
]
Here's what I've tried so far:
checked = false;
this.editObj.forEach(item => item.push(this.checked))
ERROR : item.push is not a function.
Unfortunately, my approach isn't working. Can someone help me figure out the correct way to achieve this?