Advertisement

TrimwebsolutionsTrimwebsolutions

Problem and Solutions

Transform an tab of key values into an array of key values in JS ?

By M.K. Verma · 3 May 2022

Transform an tab of key values into an array of key values in JS ?

Add this and your problems will be solved

.reduce(function(p,c){
    return {...p,...c};
},{})

Your code will look like this after adding the above code

rates.map(rate => {
       return {
         [rate]: account.vent.filter(v => v.rate === rate)[0]
           ?.vat,
       }
     })
.reduce(function(p,c){
    return {...p,...c};
},{})