This results from the two meanings of ".":
In the case of 2.toString(), it looks for an object named "2" (and numeric identifiers are forbidden). The Number '2' is still not evaluated.
In the case of 2..toString(), it evaluates "2." (same as "2.0") to the Number object, which then accesses the toString method.
It is the same as (2).toString().