I have the following object and list:
myObj = [
{ width: 10, height: 15, length: 20 },
{ width: 8, height: 10, length: 10 },
{ width: 23, height: 5, length: 5 },
{ width: 11, height: 18, length: 10 }
];
heights = {12,13,14,15};
In Javascript or jQuery what is the best way to replace the object heights with the values in the heights list? The order does matter. Results should be:
myObj = [
{ width: 10, height: 12, length: 20 },
{ width: 8, height: 13, length: 10 },
{ width: 23, height: 14, length: 5 },
{ width: 11, height: 15, length: 10 }
];
heights = [12, 13, 14, 15]