The second line fails because it is parsed as the number "100" and then "toString".
To use dot notation, any of the following will work:
(100).toString
100.0.toString
100..toString
var a = 100;
a.toString
If you are trying to call a function toString, you will also need to include parentheses:
(100).toString()
100.0.toString()
100..toString()
var a = 100;
a.toString()
I prefer using parentheses (or a variable if I already have one), because the alternatives can be confusing and unintuitive.
source
share