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; /
Let your script parse the input as string, then it will be a matter of checking if there is the point like this.
mystring.indexOf('.');
Check this example and this example.