# Converting Numbers to Strings

In JavaScript, you can use the `parseInt()` function to convert a string to an integer. This function takes two arguments: the string you want to convert and the radix, which specifies the base of the number in the string. The radix is an optional argument and the default value is 10.

For example:

```
let str = '123';
let num = parseInt(str);
console.log(num);  // Output: 123
```

Here, the string '123' is converted to the number 123.

You can also use the `parseFloat()` function to convert a string to a floating point number. This function works in a similar way to `parseInt()`, but it can parse decimal numbers as well.

```javascript
let str = '3.14';
let num = parseFloat(str);
console.log(num);  // Output: 3.14
```

It's important to note that the `parseInt()` and `parseFloat()` functions will only work if the string consists solely of a valid number. If the string contains any non-numeric characters, the functions will return `NaN` (not a number).

For example:

```javascript
let str = '123abc';
let num = parseInt(str);
console.log(num);  // Output: NaN
```

In this case, the string '123abc' is not a valid number, so `parseInt()` returns `NaN`
