Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

177
Visualizações
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 Respostas
Responde à pergunta

0

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

about 4 years ago · Santiago Gelvez Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda