1// JavaScript uses the 64-bit IEEE-754 floating point standard for storing numbers
2const num = 314.15926535;
3// toFixed(n) will convert a float to a string with n digits after the decimal point
4num.toFixed() // "314" (same as num.toFixed(0))
5num.toFixed(2) // "314.16"
6num.toFixed(6) // "314.159265"
7// toPrecision(n) will convert a float to a string with n digits total
8num.toPrecision() // "314.15926535" (same as input)
9num.toPrecision(2) // "3.1e+2" (sometimes will be in scientific notation)
10num.toPrecision(6) // "314.159"