Type Coercion
JavaScript automatically converts between types in certain situations. This is called type coercion.
Implicit Coercion
Loading JavaScript Playground...
Explicit Type Conversion
Loading JavaScript Playground...
Common Gotchas
Loading JavaScript Playground...
typeof Operator
Loading JavaScript Playground...
Exercise: String to Number
Convert a string price to a number and calculate total:
Loading JavaScript Exercise...
Exercise: Type Check
Check the type of several values:
Loading JavaScript Exercise...

