I have an array object of variable length and i want to replace specific key elements of whole array with another array object which is also of variable length. I have tried different array methods but i am stuck at this one. I have 6 months of programming experience.
My code is:
a = [
{ id: 1, name: "Alex", qty: 6, prodCode: 1321 },
{ id: 2, name: "carry", qty: 2, prodCode: 1641 },
{ id: 1, name: "manuel", qty: 7, prodCode: 1754 },
.....]
b= [{qty:5},{qty:9},{qty:2},...]
a.length===b.length
Result should be like:
[
{ id: 1, name: "Alex", qty: 5, prodCode: 1321 },
{ id: 2, name: "carry", qty: 9, prodCode: 1641 },
{ id: 1, name: "manuel", qty: 2, prodCode: 1754 },
.....]
a.length === b.length?