valueOf (Number - JavaScript)
Gets the value of a Number object as a double.
Defined in
Number (Standard - JavaScript)Syntax
valueOf() : double
Return value | Description |
---|---|
double |
The double value of this object. |
Examples
This example gets the values of three numbers and performs a calculation.function p(stuff) {
print("<<<" + stuff + ">>>");
}
var integer : Number;
var fixed : Number;
var flot : Number;
try {
integer = new Number(54321);
fixed = new Number(543.21);
flot = new Number(54321E-2);
p(integer.valueOf() + fixed.valueOf() - flot.valueOf());
// prints <<<54321>>>
} catch(e) {
p("Error = " + e);
}