I have this in my code:
let obj = {EdadBeneficiario1: '32', EdadBeneficiario2: '5'}
var years = [];
let i;
for (i= obj;i<=obj;i++)
{
years.push({ edad_beneficiario : i })
}
the output is
[
edad_beneficiario:{EdadBeneficiario1:"32", EdadBeneficiario2:"5"}
]
but what i want is this
[
{edad_beneficiario:"32"},
{edad_beneficiario:"5"}
]
what can i do?
EDIT
By the way, if i do this
years.push({ edad_beneficiario :obj.EdadBeneficiario1})
years.push({ edad_beneficiario :obj.EdadBeneficiario2})
the output what i want resolve but i want it to do it with a for loop. Please, Help.