`ExponentPart` after `HexIntegerLiteral`
# Yusuke Suzuki (14 years ago)
Hello,
0xFFe2 is valid HexIntegerLiteral, because 'e' and '2' is one of the hex digit. So I think it is OK.
0xFFe2 // 65506 0xFFe3 // 65507
Thanks.
# Mathias Bynens (14 years ago)
Oh my, that was embarrassing. Haven’t trolled myself like that in a long time.
Thanks Yusuke!
The spec grammar for
HexIntegerLiteralis as follows: es5.github.com/x7.html#x7.8.3HexIntegerLiteral :: 0x HexDigit 0X HexDigit HexIntegerLiteral HexDigit
HexDigit :: one of 0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F
Note that no
ExponentPartseems to be allowed here.However, a lot of engines seem to support exponents after hex integer literals:
I couldn’t find this in the spec though. Is this defined anywhere? Is this expected behavior or not?
The spec grammar for `HexIntegerLiteral` is as follows: http://es5.github.com/x7.html#x7.8.3 HexIntegerLiteral :: 0x HexDigit 0X HexDigit HexIntegerLiteral HexDigit HexDigit :: one of 0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F Note that no `ExponentPart` seems to be allowed here. However, a lot of engines seem to support exponents after hex integer literals: 255; // 255 0xFF; // 255 255e2; // 25500 0xFFe2; // 65506 I couldn’t find this in the spec though. Is this defined anywhere? Is this expected behavior or not?