Hello All,
How can I convert a value to Double in JavaScript??? In
vbscript i believe its done as
Javascript's only numeric type is an IEEE double precision floating
point number, so if you convert any value into a number that number will
be a double.
The shortest conversion of a value into a number is with the unary plus
operator
var numericVal = (+otherValue);
The most self-documenting is to pass the value as an argument to the
Number object constructor called as a function:-
var numericVal = Number(otherValue);
cDbl(Value)
I tried lots of way but getting a value of "NaN".
That is a different issue, it implies that the value you are trying to
convert is Not a Number (NaN) when type converted into a number. That
may be that it is a string that is not in the correct form to be
converted into a number, or it is an object of some sort that does no
have a - valueOf - method that returns a number primitive or a value
that will type-convert into a number.
Without seeing the input value, and what you are doing with it, it will
not be possible to say.
Richard.