Hi Friends đź‘‹,

Welcome To Infinitbility! âť¤ď¸Ź

To convert string to number in javascript, use `+` unary plus oprator itâ€™s one of the fastest way to convert string to int. letâ€™s take a example

The unary plus operator (+) precedes its operand and evaluates to its operand but attempts to convert it into a number, if it isnâ€™t already.

In the following example, we can able to convert string to number, float or any negative number using `+` unary plus oprator.

``````// Int
console.log(+"90") // 90

// Float
console.log(+"90.90") // 90.9

// Negative Number
console.log(+"-90") // -90
``````

Today, Iâ€™m going to show you How do i convert string to number in javascript, as above mentioned here, Iâ€™m going to use `+` unary plus oprator to convert string to number.

Letâ€™s start todayâ€™s tutorial how do you convert string to number in javascript?

In this example, we will do

1. Convert string to integer
2. Convert string to decimal
3. Convert string to negative number
``````// Convert string to integer
let first = "100";
first = +first;
console.log(first); // 100

// Convert string to decimal
let second = "25.386";
second = +second;
console.log(second); // 25.386

// Convert string to integer
let third = "-100";
third = +third;
console.log(third); // -100
``````

In the above exampls, we have taken multiple string number types examples to convert it into numbers, Letâ€™s check the output.