Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

123
Visualizações
how to for loop object in javascript

I want to loop through req.body payload object in a nodejs application and get the array object with SplitType = 'FLAT'. So after I finish looping through the array object I'll push the value into an empty array. I'm getting an error saying the SplitType is not defined. below is the object array that I want to loop through.

{
"ID": 13092,
"Amount": 4500,
"Currency": "NGN",
"CustomerEmail": "anon8@customers.io",
"SplitInfo": [
    {
        "SplitType": "FLAT",
        "SplitValue": 450,
        "SplitEntityId": "LNPYACC0019"
    },
    {
        "SplitType": "RATIO",
        "SplitValue": 3,
        "SplitEntityId": "LNPYACC0011"
    },
    {
        "SplitType": "PERCENTAGE",
        "SplitValue": 3,
        "SplitEntityId": "LNPYACC0015"
    },
    {
        "SplitType": "RATIO",
        "SplitValue": 2,
        "SplitEntityId": "LNPYACC0016"
    },
    {
        "SplitType": "FLAT",
        "SplitValue": 2450,
        "SplitEntityId": "LNPYACC0029"
    },
    {
        "SplitType": "PERCENTAGE",
        "SplitValue": 10,
        "SplitEntityId": "LNPYACC0215"
    },
]

}

Here is the for loop code

for (let i = 0; i = splitInfo.length; i++) {
    if(splitInfo[i].SplitType === 'FLAT') {
      result.initialBalance = flat(initialBalance, splitInfo.SplitValue);
      result.SplitBreakdown.push({
        SplitEntityId: splitInfo.SplitEntityId,
        Amount: splitInfo.SplitValue
      });
    }
  }
about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

0

Your loop is wrong, I think you mean:

for (let i = 0; i < splitInfo.length; i++) {
about 4 years ago · Santiago Gelvez Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda