# 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>`undefined`  
</td><td>`NaN`  
</td></tr><tr style="height: 29.7167px;"><td style="height: 29.7167px;">`null`  
</td><td style="height: 29.7167px;">0  
</td></tr><tr style="height: 29.7167px;"><td style="height: 29.7167px;">`true and false`</td><td style="height: 29.7167px;">`1` and `0`  
</td></tr><tr style="height: 29.7167px;"><td style="height: 29.7167px;">`string`  
</td><td style="height: 29.7167px;">`Empty string is 0, then convert the string to number, if any non-digit character are present results in NaN`</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.