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

211
Views
Javscripts prints 1024 when I console.log(02000)

I am working with an array of numbers

let nums = [02000, 02000, 02200, 02020,02002]


The problem is when I console.log(nums) it prints out [1024,1024,1152,1040,1026].

Why is it changing my numbers?

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

0

In JavaScript, Numeric Literals have their own lexical grammar.

When numbers start with a leading 0, it may be interpreted as an octal.

Note that decimal literals can start with a zero (0) followed by another decimal digit, but if all digits after the leading 0 are smaller than 8, the number is interpreted as an octal number.

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!