JSFiddle - React, Tailwind, and code Playground

JavaScript

var num = 2.855999999999
num = Math.round(num * 1000) / 1000
alert(num);