var x = 1.2345; var y = x.toFixed(0); //y equals 1; var y = x.toFixed(2); //y equals 1.23 var y = x.toFixed(5); //y equals 1.23400
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter