Issue
I was writing some Javascript when I accidentally typed 04.5
instead of 40.5
. When I ran the code, it produced a SyntaxError that read Uncaught SyntaxError: Unexpected number
. I tested this in Chrome, Safari, Firefox, and NodeJS, and they all produced the same error. I looked through the Javascript specifications, but I couldn't find anything on it. What is Javascript interpreting a decimal number with a 0 before it as?
04.5 // Uncaught SyntaxError: Unexpected number
Solution
With a leading zero it's interpreted as octal. But it seems that octals are not liked with decimal places.
Answered By - Sascha Answer Checked By - Cary Denson (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.