66
rated 0 times
[
68]
[
2]
/ answers: 1 / hits: 5291
/ 4 Years ago, thu, february 27, 2020, 12:00:00
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.
More From » typescript