I have an object of type "Sorteio" and inside it a vector of objects of type "Resultado", specifically 6 Resultados. I'm instantiating them this way:
saveSorteio() {
var data = {
loteria: this.sorteio.loteria,
resultados: [
{
valor: this.sorteio.resultados[0].valor,
animal: this.sorteio.resultados[0].animal
},
{
valor: this.sorteio.resultados[1].valor,
animal: this.sorteio.resultados[1].animal
},
/* ... */
]
};
}
Is there another way to instantiate the 6 at once or do I need to keep calling index by index?