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

351
Views
Why does passing 0 to the radix of parseInt in Javascript return decimal values?

Consider the following expression

console.log( 'result: ' + parseInt("1", 0) )

It returns 1 in the console of chrome (basically returns the decimal value).

The MDN docs for parseInt says

Or NaN when the radix is smaller than 2 or bigger than 36 ...

It would be great if someone could give an explanation for this.

Thanks in advance.

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

0

MDN is summarizing the specification, and is not complete.

The actual specification says:

If radix is undefined or 0, it is assumed to be 10 except when the number begins with the code unit pairs 0x or 0X, in which case a radix of 16 is assumed.

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!