In Javascript, one of the reliable ways to convert a string to a number is the Number constructor:
Number
var x = Number(\'09\'); // 9, because it defa
Number (without new) doesn't seem to result exactly in a primitive. In the following example the anyMethod() is called (if in the Number prototype).
Number(3).anyMethod()
Whereas
3.anyMethod()
will not work.