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();
(1).toString();
Today it occurred to me to try the following:
0.1.toString();
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;
obj['1'];
also:
1['toString']();
, 1., , , . , 1., , , .