JSFiddle - React, Tailwind, and code Playground

by jessekinsman

HTML

<h1 id="result"></h1>

JavaScript

function isFloat(num) {
if (isNaN(num)) {return "Not a number"; }
else if(num % 1 === 0 ) { return true; }
else { return false; }
}

var result = isFloat(2.5);
document.getElementById("result").innerHTML = result;