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 try catch lifecycle. not printing my defined error

javascript try catch error, not printing defined error. what's happening here. and why NaN printing.

let num = "sflkj"

try {
    let thenum = parseInt(num)
    console.log(thenum)
} catch (error) {
    console.log("that is not a number.")
}

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

0

Just like the anwser above says NaN is the value parseInt returns, NaN is an abbreviation to Not a Number. It's not an error to go to catch block.

about 4 years ago · Juan Pablo Isaza Report

0

parseInt function does not throw an error and always returns something. if it was not possible to parse the number, then NaN will be returned

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!