I have the following array of objects:
[
{status: 3, name: Joe},
{status: 3, name: John},
{status: 2, name: Lucas},
{status: 1, name: Jeremiah},
{status: 1, name: Steven}
]
I would like to find and replace all objects where status is equal to 1 with the number 2 so that the resulting array would be in the same order:
[
{status: 3, name: Joe},
{status: 3, name: John},
{status: 2, name: Lucas},
{status: 2, name: Jeremiah},
{status: 2, name: Steven}
]
This array could potentially be any length from 1 to around 10,000 so I would like to find a memory-efficient approach to this scenario.
Any help is well appreciated.