1 | parseInt(...) and parseFloat(...) convert their arguments to numbers: parseFloat("12.34"); //returns 12.34 parseInt("12.34"); //returns 12 parseFloat("12.34 ft"); //returns 12.34 parseInt("111", 2); //returns 7 parseFloat("$12.34"); //returns NaN |
2 | A handy trick: var numeric_var = string_val - 0; |