Edit The Code:
See Result »
Try it Yourself - ©
w3ii.com
The toPrecision() method returns a string, with a number written with a specified length: