JSFiddle - React, Tailwind, and code Playground

by David Thomas

HTML

<ul>
    <li>2</li>
    <li>2.05</li>
    <li>2.547</li>
    <li>2.5</li>
    <li>2.04</li>
</ul>

JavaScript

$('li').text(function(i,t){
    var rounded = t.split('.')[1] ? (Math.round(parseFloat(t) * 10)/10).toFixed(1) : t;
    return t + ' (' + rounded + ')';
});