3
I have this object in which I need to take the largest portion with the rate 0 (without interest) and its value, and also take the largest number of installment available and its value.. I’ve tried it many ways and I couldn’t, someone can help me?
const obj = {
"hipercard": {
"total_amount": 187.38,
"installments": {
"1": {
"value": 119.9,
"rate": 0
},
"2": {
"value": 59.95,
"rate": 0
},
"3": {
"value": 39.97,
"rate": 0
},
"4": {
"value": 29.98,
"rate": 0
},
"5": {
"value": 23.98,
"rate": 0
},
"6": {
"value": 27.53,
"rate": 10
},
"7": {
"value": 24.63,
"rate": 10
},
"8": {
"value": 22.47,
"rate": 10
},
"9": {
"value": 20.82,
"rate": 10
}
}
},
"Amex": {
"total_amount": 187.38,
"installments": {
"1": {
"value": 119.9,
"rate": 0
},
"2": {
"value": 59.95,
"rate": 0
},
"3": {
"value": 39.97,
"rate": 0
},
"4": {
"value": 29.98,
"rate": 10
},
"5": {
"value": 23.98,
"rate": 10
},
"6": {
"value": 27.53,
"rate": 10
},
"7": {
"value": 24.63,
"rate": 10
},
"8": {
"value": 22.47,
"rate": 10
},
"9": {
"value": 20.82,
"rate": 10
}
}
}
}
What you call "parcel"?
– Sam
parcels are keys within installments, "1", "2" ...
– Raykard Aguiar
So you want to know
value
greater with therate: 0
and also thevalue
of the largest share (would be the share9
) regardless of yourrate
correct? what names you want to give them?– Sergio
yes, more not always the value of the maximum part will be 9, it can come 12x for example... parcela_sem_juros, valor_sem_juros || parcela_sem_juros, valor_com_juros Thanks!
– Raykard Aguiar