JavaScript Reference/Javascript Methods/toFixed

Материал из Web эксперт
Версия от 11:22, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

"toFixed()" Example

   <source lang="javascript">
   

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


     </source>
   
  


"toFixed()" is applied to

   <source lang="javascript">

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

     </source>
   
  


"toFixed()" Syntax Parameters and Note

   <source lang="javascript">

Note: Rounds the Number to the specified number of decimal places.

Syntax:

numberName.toFixed(param1) Parameters:

   param1   Required; the number of decimal places. 
   
     
     </source>