What's the difference between
a *= 1
This is the purpose of multiplication, you accept and multiply it by 1.
a = +a
This is a simple assignment using the unary plus operator. It evaluates a and converts it to a number.
The main difference between the unary plus operator and parseInt or parseFloat is that unary can convert string representations of both integers and float, as well as non-line values ββtrue, false, and null. Where, since parseInt and parseFloat can only convert a string to int and float respectively.
Also, the parseInt method allows you to set up a basic system (basic / mathematical numerical system). i.e.
parseInt(a, 10);
source share