JSFiddle - React, Tailwind, and code Playground
by Alejandro
HTML
Enter a number: <input type="text"> <button>Go</button>
<p id="roundDown"></p>
<p id="roundUp"></p>
<p id="roundNearest"></p>
JavaScript
$('button').click(function () {
var numb = $('input').val();
$("#roundDown").text('Rounded down: ' + Math.floor(numb / 10) * 10);
$("#roundUp").text('Rounded up: ' + Math.ceil(numb / 10) * 10);
$("#roundNearest").text('Rounded to nearest: ' + Math.round(numb / 10) * 10);
});