JSFiddle - React, Tailwind, and code Playground

by Graham Fairweather

JavaScript

function isInteger(nVal) {
    return typeof nVal === "number" && isFinite(nVal) && nVal > -9007199254740992 && nVal < 9007199254740992 && Math.floor(nVal) === nVal;
}

console.log(isInteger(1e6));
console.log(isInteger(+"1e6"));