code:
console.log(0100);
console.log(050);
console.log(025);
console.log(02);
console.log(01000);
returns:
40
21
2
512
anyone know why?
code:
console.log(0100);
console.log(050);
console.log(025);
console.log(02);
console.log(01000);
returns:
40
21
2
512
anyone know why?
Its converting the number following the 0 to octal.
thank you! do you happen to know why?
The number following 0 is in octal. When you log it to the console it is converted to decimal.
So 100 octal (base 8) converts to 64 decimal. While 50 octal converts to 40 base 10.