JSFiddle - React, Tailwind, and code Playground JavaScript var num = 15.67789; num = num.toString().substr(0,'15.67789'.indexOf('.')+3); alert(num);