Posts

Showing posts from February 6, 2019

Coercion in JavaScript

Image
7 1 I was wondering a few things about coercion. When you do: 1 == true // true Which one is coerced into which one ? is it the left one or the right one ? When you do undefined == null // true How does it work exactly ? In which order does it try to convert it ? By instance: 1) String(undefined) == String(null) // false 2) Number(undefined) == Number(null) // false 3) Boolean(undefined) == Boolean(null) // true Does it first try to coerce the left side operand ? then the right ? then both ? javascript coercion share | improve this question edited 34 mins ago tomerpacific