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

178
Vistas
Javascript function is not running after being called

I'm working on a function for part of a program I'm making to transpose guitar chords based on the position of a capo - not super relevant. For whatever reason, the function is not running when I call it.

function findNewChordNums(inputArr){
    for(let i=0; i<inputArr; i++){
        console.log(inputArr[i]);
    }
    return 0;
};

findNewChordNums(inputChordNums);

This is just the bare minimum of the function to make sure that it wasn't running (hence why all the loop does is console.log the array being passed into it). I made sure that the array I'm passing into the function (inputChordNums) is valid by logging it just before the function, and it has the proper values, so I'm not sure why it refuses to run. The values the array I'm passing in are 17, 12, and 20, so I should expect to see this new function log those numbers to the console.

My first guess was that it's because I'm returning 0, but I did that in a previous function which gave me the array I'm passing into this function, so I doubt that's the problem. I'm sure it's something obvious that my noobish brain is overlooking, any help would be appreciated!

about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

for(let i=0; i<inputArr; i++) here it should be inputArr.length

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