`ExponentPart` after `HexIntegerLiteral`

# Mathias Bynens (14 years ago)

The spec grammar for HexIntegerLiteral is as follows: 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?

# 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!