JavaScript Reference/Javascript Objects/Number

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

"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