views:

24

answers:

1

hello,

i'm currently looking at a little 3rd-party javascript library and i see a lot of "sign-prefixed" variables in it:

function_call(+value);

i know, that you can swap the sign, if you prefix a variable with '-', but why to prefix something with a '+' -- it doesn't do anything to the value, no?

thanks in advance!

+2  A: 

The + forces the value to become a Number.

>>> "1"
"1"
>>> +"1"
1
KennyTM
i understand **shame-on-me** ... i could have figured out this on my own. thanks for your help :-)
harald