Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

108
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!