It feels like I am missing something obvious here. This has been asked a number of times - and the answer usually boils down to:
var num = 4.5; num % 1 === 0; /
var num = 1;
and
var num = 1.0;
are the same. You mention that you want to treat them differently when given from a user. You will want to parse the difference when it is still a string and convert it to the appropriate number.