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

194
Views
Proper variable name for find method

I'm Japanese web developer. I'm currently thinking about the proper variable name for the result from javascript find method. I would rather not use "result" because it is too simple and it's hard to understand what's inside. Does anyone have any idea?

const targetChar = 'someName1';

let arrayOfObj = [
  {
    name: 'someName1',
    age: 38
  },
  {
    name: 'someName2',
    age: 24
  }
];

const result = arrayOfObj.find((obj) => {
  return obj.name === targetChar;
});

console.log(result);
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Any name that is in unicode is proper name so don't worry. Maybe you can check out commonly used naming conventions for commonly used javascript libraries or go with foundPeople. But if you are going to use it for an if statement you can choose isFound or hasFound which is shorter and easier to read.

The context, in other words where you are going to use the variable is important when choosing names. If the variable is global, or if you are going to use the found item later, a more descriptive name could be more helpful but if you are merely checking if such a person exist, shorter ones like isFound, hasFound or isExist is better.

about 4 years ago · Juan Pablo Isaza Report
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!