A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://webplatform.github.io/docs/javascript/Number/toFixed below:

toFixed · WebPlatform Docs

toFixed Summary

The toFixed() method formats a number to fixed-point notation (decimal).

Syntax
toFixed([ fractionDigits ])
fractionDigits
Optional. The number of digits after the decimal point. Must be in the range 0 - 20, inclusive. Defaults to 0.
Return Value

Returns a string representation of a number in fixed-point notation, containing fractionDigits digits after the decimal point.

If fractionDigits is not supplied or undefined , the default value is 0.

Examples

Using toFixed to format the decimal presentation of a number.

var pie = 3.14159;


pie.toFixed(0);



pie.toFixed(4);



pie.toFixed(10);



(1.23e+20).toFixed(2);

(1.23e-10).toFixed(2);



-3.1415.toFixed(2);

(-3.1415).toFixed(2);

Remarks Throws

RangeError when a fractionDigits outside the bounds of 0 - 20 (inclusive) was given.

Notes See also Other articles External resources Specification

15.7.4.5 Number.prototype.toFixed(fractionDigits)

ECMAScript® Language Specification Standard ECMA-262 5.1 Edition / June 2011

Attributions

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4