Please login to start chat

ICT Solutions 22 Jun 2022, 09:47:21
Category : JavaScript Tutorials

Math.round() (JS Math)

<!DOCTYPE html>
<html>
<head>
<title>JavaScript Code Testing</title>
</head>
<body>
<p id = "demo">This is JavaScript Math.round Testing</p>
<button type = "button" onclick = "jsRound()">Math Round</button>

<script>
var a = 4.576;
var b = 4.345;
document.getElementById("demo").innerHTML = a + " and " + b;

function jsRound(){
document.getElementById("demo").innerHTML = Math.round(a) + " and " + Math.round(b);
}
</script>

</body>
</html>

Comments:

No comment to show.

Available Services
Download Android Application