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

211
Vistas
how to get length of the characters in a array in javascript?

so like imagine I have an array like this

names = ["Alex", "David", "Hanna"]

so I want to get the length of the characters like Alex is 4 characters long and If I get an odd length I want to show that as an output. I can't figure out how to do it.

about 4 years ago · Juan Pablo Isaza
3 Respuestas
Responde la pregunta

0

You can use Array.filter method to filter the results


const names = ["Alex", "David", "Hanna"]
names.filter(name => name.length % 2 !== 0) // ['David', 'Hanna']

about 4 years ago · Juan Pablo Isaza Denunciar

0

Welcome Santonu to SO, you can do the following:

const names = ["Alex", "David", "Hanna"];

for (const name of names) {
  console.log(name.length);
}

This will iterate every name of the array and log you the length.

about 4 years ago · Juan Pablo Isaza Denunciar

0

const array = ["Alex", "David", "Hanna"]
array.forEach(item => {if(item.length%2 == 1)  console.log(item)});

See this for loop in javascript.

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