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

77
Vistas
How do I make names that start with the letter K appear only in the console

i need to make names that start with the letter K appear only in the console

let friends = ["keven", "Khaled", "keiven", 1, 2, "coder", "zein"];
let i = 0;
let counter = 0;


while (i < friends.length) {
    console.log(friends[i])
    i++
    if (friends[i][counter] === friends[i].includes("A")) {
        continue;
    }
}
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You can use the forEach syntax to cycle over your array, and then printing only the elements matching your request (so elements that are string and starts with a "k" letter).

friends.forEach((elem) => {
  if(elem.toString().toLowerCase().startsWith("k"))
    console.log(elem)
})
about 4 years ago · Juan Pablo Isaza Denunciar

0

  1. loop over the array
  2. get the first letter as lowerCase
  3. check if it equals to 'k'

    const friends = ["keven", "Khaled", "keiven", 1, 2, "coder", "zein"];
    for(let friend of friends){
        if(String(friend[0]).toLowerCase() === 'k'){
            console.log(friend);
        }
    }
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