I'm trying to convert a string to an int. When the string is a number with a leading zero, it seems Google Script gets into trouble. Converting "07" to 7 works fine, converting "08" ends in a NaN.
function test_parse_int() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
// parses to 7
ss.toast( parseInt("07") );
// parses to NaN ?!?
ss.toast( parseInt("08") );
}
I tested that against JavaScript and there it works fine.
<script>
// parses to 7
document.writeln(parseInt("07"));
// parses to 8
document.writeln(parseInt("08"));
</script>
This behaviour doesn't make any sense to me, is this a bug? Am i missing something?