Utilizor
Contact Us

Number Methods

Methods for working with numbers.

Number Methods

toString() returns a number as a string.

toExponential() returns a string, with a number rounded and written using exponential notation.

toFixed() returns a string, with the number written with a specified number of decimals.

toPrecision() returns a string, with a number written with a specified length.

Example

let x = 9.656;
x.toFixed(0);           // 10
x.toFixed(2);           // 9.66