Type Conversion in JavaScript — a practical guide to JavaScript type conversion with clear examples you can reuse in real projects.
JavaScript Tutorial Series (14/101). Prefer one article? Read the complete JavaScript tutorial.
Short description
Prefer explicit conversion over relying on coercion.
Conversion
Number('42'); // 42
String(42); // '42'
Boolean(0); // false
parseInt('08', 10); // 8