-1

Why do 37291+05472 and 37291+5472 give different output?

console.log(37291+05472)

console.log(37291+5472)
Washington Guedes
  • 4,254
  • 3
  • 30
  • 56
  • This is a non-standard extension only allowed in sloppy mode. Do not rely on it. Do not use leading zeros. – Oriol Dec 09 '16 at 16:00

1 Answers1

4

Starting a number with 0 declares that is an octal (base 8) and not a decimal (base 10).

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335