JavaScript Implicit vs. Explicit Coercion April 3rd, 2015

  • Using the minus or division math operator will coerce a string into a number … “123”-0 = 123
  • Never “==” to true or false, always “===”, because “==” will match falsy things like 0
  • == allows coercion (checks value) – implicit
  • === disallows coercion (checks value and type) – explicit