If type is falsey, then the callback value will be assigned to the type variable, otherwise type will be assigned.
Falsey values:
falsenullundefined0"" (empty string)NaN
So basically it says: "Replace type with callback if type is any of the falsey values.
Consider this:
var type = undefined; type = type || "default value";
As a result, the type variable will receive "default value" .
If it was like this:
var type = "some value"; type = type || "default value";
Then it will save its "some value" .
source share