I have an array of objects containing objects with similar structure. I need to add a new key value pair to all the objects in the array. How can I do it without looping the entire array.
Providing an example of the output that I require,
let arr = [{a:1,b:2}, {a:2,b:3}];
let key = c;
let value = 3;
Required output will be like,
//arr2 = [ {a:1,b:2,c:3}, {a:2,b:3,c:3}]
P.S: Tried using spread operator with little or no success.