Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Lesson 13: Type conversion

Explicit conversion vs implicit coercion.

What you'll learn

  • explicit: String(x), Number(x), Boolean(x)
  • implicit: '5' * 2 === 10, 1 + '2' === '12'
  • parseInt/parseFloat parse leading numbers from strings
  • prefer explicit conversion for readability

Example

See examples/.

Exercise

Predict the output of 6 mixed coercion expressions.