100 Days Of Javascript

Coercion in Javascript

Day 3: Coercion

To oversimplify this is the act of converting a value from one type to another. An array to a number, a string to an boolean etc.

var a = 42;
var b = a + ""; // implicit coercion
var c = String( a ); // explicit coercion

You Don’t Know JS