So ran in to an odd little error and i was hoping someone might know how to fix it so I have an object like this
Code: Select all
var icons =
{
icon1: {x: -00822600, y: 16188000, z: 01169400},
icon2: {x: -00354600, y: -03966600, z: -00562800},
etc...
};
Now from what I gather the error is caused by the leading zeros which is causing those values to be treated as octal numbers or base 8 values.SyntaxError: 08 is not a legal ECMA-262 octal constant.
So how can I force numbers with leading zeros to be evaluated as base 10 (decimal) and not base 8 (octal)
now when I used parseInt and set the radix to 10 like so
Code: Select all
var icons =
{
icon1: {x: parseInt("-00822600", 10), y: 16188000, z: parseInt("01169400", 10)},
icon2: {x: parseInt("-00354600", 10), y: parseInt("-03966600", 10), z: parseInt("-00562800", 10)},
etc...
};