# Type Conversion

### String Conversion

You can call the `String()` function to explicit convert a value to a string

```javascript
String(false) -> "false"
String(null) -> "null"
```

### Numeric Conversion

Occurs when you use math functions and expressions

```javascript
console.log("6" / "2"); // Print out 3!
```

Or you can also do it more explicitly by calling the `Number()` function.

However, note that any non-digit character that shows up in String will result in the conversion value `NaN`

```javascript
console.log(Number("lol")); // Results in NaN
```

Here is the table of conversion for some common values passed into `Number()`

<table border="1" id="bkmrk-value-becomes-undefi" style="border-collapse: collapse; width: 100%; height: 118.867px;"><colgroup><col style="width: 50%;"></col><col style="width: 50%;"></col></colgroup><tbody><tr style="height: 29.7167px;"><td style="height: 29.7167px;">Value  
</td><td style="height: 29.7167px;">Becomes

</td></tr><tr><td><code>undefined</code>  
</td><td><code>NaN</code>  
</td></tr><tr style="height: 29.7167px;"><td style="height: 29.7167px;"><code>null</code>  
</td><td style="height: 29.7167px;">0  
</td></tr><tr style="height: 29.7167px;"><td style="height: 29.7167px;"><code>true and false</code></td><td style="height: 29.7167px;"><code>1</code> and <code>0</code>  
</td></tr><tr style="height: 29.7167px;"><td style="height: 29.7167px;"><code>string</code>  
</td><td style="height: 29.7167px;"><code>Empty string is 0&#44; then convert the string to number&#44; if any non&#45;digit character are present results in NaN</code></td></tr></tbody></table>

### Boolean Conversion

Like mentioned before, any number that's besides 0 are considered to be true.

You can call the `Boolean()` function to explicitly convert a value to be either `true/false`

Non-empty strings are also considered to be true so even `"0"` is considered to be true.