i have array value and object for data mapping. reduce method is not working for object mapping, here is sample data.
the array value is
let array = [ "payload", "offer", "application_id" ]
object value is
let data = {
organization_id: 4002400004,
organization_name: 'Velocity Global Integration Sandbox',
action: 'offer_updated',
payload: {
offer: {
id: 4524843004,
application_id: 31948577004,
user_id: 4123647004,
version: 1,
sent_on: null,
resolved_at: '2022-05-19T06:21:25.084Z',
start_date: '2022-05-17',
notes: null,
job_id: 4298940004,
offer_status: 'Accepted'
},
"resume": {
name: "manikandan"
}
}
}
need to form new object with the response
let payload = {
offer: {
application_id: 343645656
}
}