Question: I have an array of objects which is passed from a parent component and I would like to add a new boolean property to each of the objects on Child Component Initiation. So far I have tried:

```
this.selectedItems.map((item) => {
    return { ...item, newProperty: false };
});

```

I also tried it using `forEach` method instead of `map`.

It adds the property while I am inside of the `map` or `forEach` methods but it does not save the changes.

How can I save the changes or is there any other way I can achieve this?

Answer: 
`map` does not modify the array. Instead it returns a new array that is the result of your map operation.

So all you need to do is capture the result.

```
const itemsWithNewProperty = this.selectedItems.map((item) => {
    return { ...item, newProperty: false };
});

```
why not use forEach?

```
this.selectedItems.forEach((item) => {
    item.newProperty=false
});

```