Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Math</h1>
<h2>The Math.fround() Method</h2>
<p>Math.fround() returns the nearest 32-bit single precision float representation of a number:</p>
<p id="demo"></p>
<script>
let a = Math.fround(2.60);
let b = Math.fround(2.50);
let c = Math.fround(2.49);
let d = Math.fround(-2.60);
let e = Math.fround(-2.50);
let f = Math.fround(-2.49);
 
document.getElementById("demo").innerHTML =
a + "<br>" + b + "<br>" + c + "<br>" + d + "<br>" + e + "<br>" + f; 
</script>
</body>
</html>