What are the rules for calling functions in numeric literals in JS?

Since I started working with JS, I thought that the only way to call a function in a numeric literal is to put it in the position of the expression, wrapping it with parsers, for example:

1.toString();
// SyntaxError: identifier starts immediately after numeric literal

(1).toString();
// "1"

Today it occurred to me to try the following:

0.1.toString();
// "0.1"

Why does this work? A pointer to the official specification will be great.

Change Surprise was my first thought, but then decided that 1.toString()there was no ambiguity. This is deeper than I thought at first, but I still think I'm right. That's why:

Property names may begin with numbers

var obj = { "1" : 1, "2" : 2 };

Property names starting with numbers can only be specified with square brackets

obj.1;
// SyntaxError: Unexpected token ILLEGAL
obj['1'];
// 1

also:

1['toString']();
// '1'

, 1., , , . , 1., , , .

+5
1

. 0.1, . .

.

edit — 7.8.3 :

, NumericLiteral, .

, , JavaScript- gnarly, -, .

+5

All Articles