let array1 = [{
"id": "lap-143240121",
"position": 0
}, {
"id": "lap-15040293",
"position": 1
}, {
"id": "lp-1504444",
"position": 2
}, {
"id": "lp-150440987",
"position": 3
}]
let array2 = [{
"id": "lap-143240121",
"name": "name1"
}, {
"id": "lap-15040293",
"name": "name2"
}, {
"id": "lp-1504444",
"name": "name3"
}]
I want to combine these two arrays based on the id, resulting in:
let combinedArray = [{
"id": "lap-143240121",
"position": 0,
"name": "name1"
}, {
"id": "lap-15040293",
"position": 1,
"value": "name2"
}, {
"id": "lp-1504444",
"position": 2,
"value": "name3"
}]