toExponential() - Round off numbers in exponential notation
Fri Jan 10 2020 19:00:00 GMT+0000 (Coordinated Universal Time)
Saved by @goblindoom95 #javascript #jsfunctions #numbers
line 1: assign a number value to the variable x line 3 & 6: rounds off the value of x in exponential notation. The number in the brackets - the parameter - defines the number of characters beyond the decimal point. Value of y is a string. NOTE: it is not necessary to store the value of toExponential() in a new variable (like in the example). Also, the parameter is optional. If you don't specify it, JavaScript will not round the number.
Comments