JavaScript Reference/Javascript Methods/toFixed

Материал из Web эксперт
Перейти к: навигация, поиск

"toFixed()" Example

    
<html>
<body>
<button onclick="var myNum = new Number(100.22); alert(myNum.toFixed(1));">
fix 100.22
</button>
</body>
</html>



"toFixed()" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |Number                                                        |
+----------------+--------------------------------------------------------------+



"toFixed()" Syntax Parameters and Note

Note:
Rounds the Number to the specified number of decimal places.
    
Syntax:
    
numberName.toFixed(param1)
Parameters:
    param1   Required; the number of decimal places.