I just run into the weirdest thing I’ve ever encounter.
Consider this test page:
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title></title>
<script language=javascript>
function test(myParameter) {
alert(myParameter);
}
</script>
</head>
<body>
<input type="button" value="Strange" onclick="javascript: test(044024);" />
<input type="button" value="Ok" onclick="javascript: test('044024');" />
</body>
</html>
If I click the “strange” button, I get 18452, if I click the “ok” button I get 044024
Does anyone know what is happening and explain it to me?
Javascript is interpreting the symbol 044024 as an octal value because of the leading 0.
044024 oct to dec is 18452