M
Mike
Why is this converted to a string???
var newidNumber =((idNumber/2).toFixed())+1;
Thanks
Mike
var newidNumber =((idNumber/2).toFixed())+1;
Thanks
Mike
Why is this converted to a string???
var newidNumber =((idNumber/2).toFixed())+1;
Because the - toFixed - method returns a string.
when you want to use the variable as a number use eval() to
return a number
No thanks, I will use the unary plus operator, the Number constructor
called as a function, parseInt or parseFloat, depending on the
situation. The - eval - function would be the absolute worst method to
use, particularly as its behaviour is unpredictable whenever its
argument is a string that does not represent a number.
On Nov 28, 10:56 am, Henry wrote:
You probably know more about Javascript,
but I have been coding for about 2 years
and the - eval -
function has always worked for me.
You suggested using - eval - so we are well past "probably".
kendalk08 said the following on 11/28/2007 11:45 AM:
Who fed you that line of incompetent ignorant crap?
Who said I did? I didn't. Anybody that uses eval(string) to convert
string to a number is an incompetent ignorant idiot.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.