Convert signed char +1 to int (Javascript)

  javascript, type-conversion

I have a char representing a number (from "-4" to "+4").
I want to get an int from it.
parseInt() doesn’"t work, as I have "+2" and not "2" to parse…

How do convert his the most simply?

  1. if =="-4", if "-3", … if "+4"
  2. strip "+3" => "+" and "3" => if first args is "+" then, else…
  3. wish there is a more beautiful solution

Thanks for any help you can provide

Source: Ask Javascript Questions