1 2 3 4 5 6 7
var getDecimal = function(num) { return +(num - Math.floor(num)).toFixed(1); }; var a = prompt(); alert(getDecimal(a));