Iterating through two objects with different structures in parallel I have two objects, one input = Array&lt;Type&gt; and one stored = Array&lt;{..., Type}&gt;

What's the best (cleanest) way to put the elements in the first array into the sub-elements of the second? We can assume they're of the same size.

My current code below works, but looks bad due to the double iterator usage.

var count = 0;
stored.forEach((obj)=&gt; {
    obj.value = input[count];
    count++;
});


Is there some sort of prototyping that I can use to shorten the code up?
You don't need the count variable to increment the index, Array.forEach accepts a second ( optional ) parameter which is the current index that you can use : 

stored.forEach((obj, index) =&gt; { 
   obj.value = input[index]; 
});


OR

stored = stored.map((obj, index) =&gt; ({...obj, value: input[index]}))


example : 



let stored = [{ name : 'a', value: 2 }, {name : 'b',  value: 4 }, { name : 'c',  value: 6 }];
let input = [10, 11, 12];


stored.forEach((obj, index) =&gt; { obj.value = input[index]; });

// OR
// stored = stored.map((obj, index) =&gt; ({...obj, value: input[index]}))

console.log(stored)