<!DOCTYPE html>
<html>
<body>

<p>The Number.isSafeInteger() function returns true if the value is a safe integer.</p>

<p>Click the button to check whether the values are safe integers.</p>

<button onclick="myFunction()">Try it</button>

<p id="demo"></p>

<p><strong>Note:</strong> The Number.isSafeInteger() method is not supported in IE 11 (and earlier versions).</p>

<script>
function myFunction() {
    var res = "";
    res = res + Number.isSafeInteger(123) + ": 123<br>";
    res = res + Number.isSafeInteger(-123) + ": -123<br>";
    res = res + Number.isSafeInteger(5-2) + ": 5-2<br>";
    res = res + Number.isSafeInteger(0) + ": 0<br>";
    res = res + Number.isSafeInteger(0.5) + ": 0.5<br>";
    res = res + Number.isSafeInteger(Math.pow(2, 53)) + ": 2<sup>53</sup><br>";
    res = res + Number.isSafeInteger(Math.pow(2, 53) - 1) + ": 2<sup>53</sup> - 1<br>";    
    res = res + Number.isSafeInteger('123') + ": '123'<br>";
    res = res + Number.isSafeInteger(false) + ": false<br>";
    res = res + Number.isSafeInteger(Infinity) + ": Infinity<br>";
    res = res + Number.isSafeInteger(-Infinity) + ": -Infinity<br>";
    res = res + Number.isSafeInteger(0 / 0) + ": 0 / 0<br>";

    document.getElementById("demo").innerHTML = res;
}
</script>

</body>
</html>