The array I have is as follows. Let's call this array reduction.
var reduction = [
{
ReductionID: 5813,
PatiendID: 945994,
ProviderAcctNumber: "",
Discharge: "945994 : 01/01/0001 - 01/01/001",
Selected: 1,
Balance: 20,
Charges: 10
}
];
I want a new array (patientDetails) with only two values in the format
{
PID: 945994 // which is PatientID in the reduction array
selection: 1// which is Selected in the reduction array
}
What I want in the second array is :
- Only two values from 1st array(reduction)
- The two names should be different in 2nd array(ie., PatientID should ne PID)
- Values are same as the values in 1st array
Is it possible to do with map() function ?
forloop. Have you tried?Array.prototype.map()