i have an array below
const sampleResponse = [
{
benefitTypeCode: 'HE',
benefitTypeValue: 'HEALTH',
},
{
benefitTypeCode: 'DE',
benefitTypeValue: 'DEATH',
},
];
how to manipulate array string into our desire string
my goals
const sampleResponse = [
{
benefitTypeCode: 'HE',
benefitTypeValue: 'live',
},
{
benefitTypeCode: 'DE',
benefitTypeValue: 'passed away',
},
];
need advise.. sorry im newbie , thanks a lot btw.
3
Answers
simply make object for it and use it’s index
like this :
Try this approach:
Create a map with new values
And convert old array
It’s an object. So, you can iterate through it and change the value of your desired key you want to modify. Hope, the below code will be helpful.
console.log(sampleResponse)