JSFiddle - React, Tailwind, and code Playground JavaScript var num = 15.57789; num = num.toString().replace(/^(\d+\.\d{2}).*/g, '$1'); alert(num);