/
toFixed.xml
31 lines (29 loc) · 1.26 KB
/
toFixed.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../../../../template/methodWrapper.xsl"?>
<method name="toFixed" parent="Number" xmlns="http://www.jsman.net/xsd/manual"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.jsman.net/xsd/manual ../../../../schema/jsman-manual.xsd">
<lead>
<p>toFixed — Returns a string representation of the specified Number object.</p>
</lead>
<description>
<p>Number.toFixed(<params/>)</p>
</description>
<parameters>
<parameter default="0" name="decimals" type="integer" optional="true">A number between 0 and 20 representing number of digits.</parameter>
</parameters>
<examples>
<example>
<heading>toFixed example</heading>
<code>
var n = new Number(42.12345);
console.log(n.toFixed()); // Will be the primitive string "42".
console.log(n.toFixed(2)); // Will be the primitive string "42.12".
console.log(n.toFixed(4)); // Will be the primitive string "42.1235".
console.log(n.toFixed(6)); // Will be the primitive string "42.123450".
</code>
</example>
</examples>
<external>
<mdn href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed">Number.toFixed method</mdn>
</external>
</method>