I created a simple apps script as follows:
function testeBug() {
Logger.log(parseInt("07"));
Logger.log(parseInt("08"));
}
And here's the logger output:
[13-06-19 23:09:13:130 BRT] 7.0 [13-06-19 23:09:13:130 BRT] NaN
Why this is happening? I'm using Google Apps Script
You need to pass in the radix parameter to parseInt
Failure to do so causes some browsers to treat strings with a leading zero as base-8, which is what you're seeing, since 07 in base-8 is 7, while 08 is invalid.
07 is valid octal notation, 08 is not.