y = 15;
let x = y.toString(10);
console.log(x)
This prints '15' but
let x = 15.toString(10);
console.log(x)
gives Error: Invalid or unexpected token Why?
y = 15;
let x = y.toString(10);
console.log(x)
This prints '15' but
let x = 15.toString(10);
console.log(x)
gives Error: Invalid or unexpected token Why?
It works with another dot for separating the property from number.
let x = 15..toString(10);
console.log(x);