JSFiddle - React, Tailwind, and code Playground

HTML

<input type='text' id="abc"/>
<button onclick = 'test()'>Test</button>

JavaScript

function test() {    
    var val = $('#abc').val();
    var str = '';
    val = Math.round( val * 10 ) / 10;
    str += 'with round: ' + val + '\n';
    
    var val2 = val.toFixed(1);
    str += 'with toFixed(1): ' + val2;
    alert(str);
}