I need to looping thought two arrays and find where is value expanded = true set to first array?
example of first array:
[
{ id: 1 , name: 'Test 1' , expended = false },
{ id: 2 , name: 'Test 2' , expended = false },
{ id: 3 , name: 'Test 3' , expended = false }
]
exaple of second array:
[
{ id: 1 , name: 'Test 1' , expended = false },
{ id: 2 , name: 'Test 2' , expended = true },
{ id: 3 , name: 'Test 3' , expended = false }
]
Different between two array is only expended value where is on second array is :
{ id: 2 , name: 'Test 2' , expended = true }
I need to loop thought first array and second and find in second array where is expended = true and just paste on first array.
The expected result above after the loop should be:
first array value
[
{ id: 1 , name: 'Test 1' , expended = false },
{ id: 2 , name: 'Test 2' , expended = true },
{ id: 3 , name: 'Test 3' , expended = false }
]
Please, I can't just copy the value of all array!
this example is not accepted:
this.secondArray = this.firstArray..
This is a simple example I sent you. I have 10 more parameters in the object that are changing, but it is only important for me to be expended to copy!
Literally, the value expended from the second array to copy to the first and that's it!