I dont understand why this happened


#1



I understand objects pretty well(I might go through it again to get the hang of it), but something strange happened...

https://www.codecademy.com/en/courses/javascript-beginner-en-9Sgpi/3/1?curriculum_id=506324b3a7dffd00020bf661


var robot = new Object();
robot.id = 0002020110304;

var myArray = [12, false, "James", robot];

When I ran this code, I got the output "272666820". I know the last part of the object gets printed to the console, but why did a different number get printed than what I had for the .id of the robot object? Is ".id" a function?


#3

You get that because of the extra leading zeros here:

Hope this helps! :smile:


#4

So it's like all real numbers: you can't have a zero in front of it?


#5

In JS, numbers that begin with 0 and are followed by octal digits are octal and not decimal numbers.