In JavaScript, a plus symbol (+) in front of a variable casts it to a number

2019-05-08

For example, +"1" returns 1.

If the value can’t be converted to number type, it will return NaN.

For example , +"a" or +{} return NaN.