' Math.round(x) restituisce il valore di x arrotondato al numero intero piu' vicino:
https://www.w3schools.com/js/tryit.asp?filename=tryjs_math_round <!DOCTYPE html> <html> <body> <h2>JavaScript Math.round()</h2> <p>Math.round(x) returns the value of x rounded to its nearest integer:</p> <p id="demo"></p> <script> document.getElementById("demo").innerHTML = Math.round(4.4); </script> </body> </html> |