<body>
<p>Math.round() rounds a number to its nearest integer:<p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
document.getElementById("demo").innerHTML =
Math.round(4.3);
}
</script>
</body>
Math.round() rounds a number to its nearest integer: