There are 2 main ways to convert a string to a number.
Number("123.456"); // 123.456
Another method is using
parseInt(). This returns the nearest rounded down integer.
parseInt("123.456"); // 123
The following method is the one that I recently came across. It was a rather interesting way to convert a string to a number.
~~"123.456"; // 123
This particular method ignores the decimal place and no rounding happens; just slightly different from the