I have a sample code below
let arr = [
{ name:"string 1", value:"value1", other: "other1" },
{ name:"string 2", value:"value2", other: "other2" }
];
let obj = arr.find((o, i) => {
arr[i] = { name: 'new name', value: 'new value', other: 'that' };
return true; // stop searching
});
console.log(arr);
I want to replace all the array value with name " new name " and value "new value" , right now it is changing only first array index value.