Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

197
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda