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

144
Vistas
I want to know what this line of code mean: /[a-zA-Z]/

I want to move the first character of a string to the end and then add "ay" to it, I tried to solve it but I couldn't and then I found this solution. can you please explain to me the logic in this code.

function pigIt(str){
  str = str.split(' ');
  for(let i = 0;i<str.length;i++){
    if(/[a-zA-Z]/.test(str[i])){
      str[i] = str[i].slice(1) + str[i][0] + 'ay';
    } 

  }
  return str.join(' ');
}
console.log(pigIt('Pig latin is cool'));

about 4 years ago · Santiago Gelvez
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