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

131
Views
Javascript function for counting numbers within strings

Newbie here. Trying to write a function that accepts an array of strings and counts the number of strings that can be converted to a number. example: ['1', 'h','3','l','p','7'] should return 3.

function countNumbers(arr) {
  for (let i of arr) {
    let num = parseInt(i);
    let total = 0
    if (num >= 0) {
      total++;
      return total
    }
  }
}

console.log(countNumbers(['1', 'h','3','l','p','7']));

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