Javascript Type Conversion | number(), parseInt(), parseFloat(), toString()

Using type Conversion we can change the datatype of one variable to another variable.

Converting Number to String

Converting String to Number

We can use built-in methods to convert strings to numbers.
The methods are Number(), parseFloat(), parseInt() and we’ll also be using `type of` statement to check its datatype.

Using Number() objects

Using parseFloat() method

Using parseInt() method

As you can see in `parseInt()` method the decimal points are omitted this is because the `num` variable is of type integer and
does not have decimal points.

Related Posts