0

In javascript every variable we declare as var var irrespective of data type(int,String etc).

I got shocked when I faced something in javascript when trying to print a number begins with 0, it prints a awkward number.

E.G.

 var x=0622211646;

console.log(x); it prints this number :105452454

Why such awkward happens in javascript?

  • 4
    It's [Octal](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/parseInt#Octal_interpretations_with_no_radix) notation – Alex K. Apr 05 '17 at 14:04
  • 1
    Here is a good explanaition about leading 0 [Leading 0 in JS](http://stackoverflow.com/questions/35047982/javascript-0-in-beginning-of-number) – K. Khanda Apr 05 '17 at 14:06

0 Answers0