- Home
- /
- Tutorials
- /
- JavaScript Tutorial
- /
- JavaScript Type Conversion
JavaScript Type System
JavaScript Type Conversion
Type conversion changes a value from one type to another on purpose.
Doing it deliberately is called explicit conversion, or casting.
When JavaScript does it for you it is called coercion, which is the next lesson.
Example
Example
javascript
const text = "42";
const number = Number(text);
console.log(number + 8);
console.log(typeof number);The output is 50 then number.
