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

167
Views
javascript remove leading zeros from a number
const a = 043      
console.log(Number(a))       

Here the variable a is octal because of which we get the result as 35. Instead, I want the variable a to be a number 43. Found results for removing leading zeros from a string(Remove leading zeros from a number in Javascript)

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

0

Because your value starts with 0, and its type is number instead of string, it will be recognized as octal, and when you use it directly, javascript will convert it to decimal

The fastest way you can use Number.prototype.toString(radix)

let a = 043
console.log(a.toString(8))

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!