Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

176
Views
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 answers
Answer question

0

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

about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!