Y
Yaffle
Using "+(x)" is better, than parseInt(x,10) ?!?
(if string "x" contains only decimal numbers)
(if string "x" contains only decimal numbers)
Yaffle said:Using "+(x)" is better, than parseInt(x,10) ?!?
(if string "x" contains only decimal numbers)
Using "+(x)" is better, than parseInt(x,10) ?!?
(if string "x" contains only decimal numbers)
Suppose, for example, I have a function range() that requires a number
as its argument. I could convert the argument inside range().
Or I could write
range(+x);
when I call range. I like this. It's saying that 'x' might be a
string, and I'll be converting it to a number.
Using "+(x)" is better, than parseInt(x,10) ?!?
(if string "x" contains only decimal numbers)
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.