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

116
Visualizações
My function returns undefined even if the value is there

I've already tried a lot of stuff and IDK what to do anymore.

The idea is to get the object key, from the discord value and then return it.

But it refuses to work, I've already tried other ways and got the same result.

Example users value:

"45556874": {
      "discord": [
        "592881581857701908"
      ],
      "debugger": true,
      "blacklisted": false,
      "games": []
    },
"101426233": {
      "discord": [
        "592881581857701908"
      ],
      "debugger": true,
      "blacklisted": false,
      "games": []
    },
"2589755903": {
      "discord": [
        "592881581857701908"
      ],
      "debugger": true,
      "blacklisted": false,
      "games": []
    },
"2804506785": {
      "discord": [
        "900280562781138944"
      ],
      "debugger": false,
      "blacklisted": false,
      "games": []
    }

Function:

async function getRoblox(Id){
  const users = await db.get("users");
  let RoId = null;
  for (const entry of Object.entries(users)) {
    const [roId, value] = entry;
      if(Array.isArray(value.discord)){
      for (const DisId of value.discord) {
        if (DisId === Id) {
          RoId = roId;
        }
      }}
    };
  return RoId;
}
about 4 years ago · Santiago Trujillo
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