parseInt("123ax4");will return 123.
This is a very different behavior than how Java, or C would work. So, if you see this dangerous, then there is a better way to do it.
The Unary + Operator:
Using the unary + operator to convert strings to numbers guarantees you that either the entire string is a valid number, in such case the converted number value is returned as a result of the expression, or if there is any invalid number in the string, NaN is returned. So the output of the statement
+ "123";results in the integer value 123. The output of the statement
+ "123a";is NaN.