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

165
Views
function input not defined in javascript
function validParentheses(parens) {
    let opening = 0;
    let closing = 0;
    for (i=0; i<parens.length; i++) {
        if (parnes[i] == "(") {
            opening++;
        } else if (parens[i] == ")") {
            closing ++
        }
    }
    return opening === closing;
}

I made this code for Codewars kata and it says that parens is not defined, and I have no idea why, and the link for the kata is this. I would be really grateful if someone knows why.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I saw your question, and i check in codewars.
Hopefully I found why yout code not working!
in your code, input parameter called as parens, But Codewars search with parnes.

Just need to change parens to parnes!

function validParentheses(parnes) {
let opening = 0;
let closing = 0;
for (i=0; i<parnes.length; i++) {
    if (parnes[i] == "(") {
        opening++;
    } else if (parnes[i] == ")") {
        closing ++
    }
}
return opening === closing;

it's work for me and all of Result is passed

My Results Image

I hope it's work for you

about 4 years ago · Juan Pablo Isaza 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!