01
Overview
Explicit: Number(x), parseInt. Implicit: 5*2===10. Falsy: false,0,empty,null,undefined,NaN. Use === to avoid surprises.
bash
Number("42"); parseInt("42px",10);
"5"+3 // "53" "5"-3 // 202
Best Practices
Use === and !==. Convert explicitly at boundaries. Validate with Number.isFinite. Use TypeScript for safety.
Ready to try Type Conversion & Coercion?
Visit the official site for the latest version and full documentation.
Visit Type Conversion & Coercion