What exactly is type coercion in Javascript?
For example, on the use of == instead of ===?
a == b means javascript will evaluate a against b based on if the values can be evaluated equally. For example, false == 0 will evaluate true because 0 is also the value of Boolean false. However, false === 0 will evaluate false because strictly comparing, 0 is not the same physical value as false. Another example is false == '' So basically loose comparison vs. strict comparison, because javascript is a loosely typed language. That is to say, javascript will attempt to convert the variable based on the context of the code, and this has the effect of making things equal if they are not strictly compared. php also has this behavior.