JavaScript Reference/Javascript Objects/Number — различия между версиями

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

Текущая версия на 08:22, 26 мая 2010

"Number" Example

    
<html>
<body>
<script language="javascript">
function function1(){
    var number = new Number(23003.340304);
    alert(number.toFixed(2)); 
} 
</script>
<button onclick="function1();">Round the number</button>
</body>
</html>



"Number" JavaScript Methods

+----------------+--------------------------------------------------------------+
| JavaScript     |toExponential                   toFixed                       |
| Methods        |toLocaleString                  toPrecision                   |
|                |toString                        toSource                      |
|                |valueOf                                                       |
+----------------+--------------------------------------------------------------+



"Number" JavaScript Properties

+----------------+--------------------------------------------------------------+
| JavaScript     |constructor                     MAX_VALUE                     |
| Properties     |MIN_VALUE                       NEGATIVE_INFINITE             |
|                |POSITIVE_INFINITE                                             |
+----------------+--------------------------------------------------------------+



"Number" Syntax and Note

Note:
Perform numerical operations.
    
Syntax:
    
var numberName = new Number(value) // value is any number
numberName.memberName