Does JavaScript not have something like "bool(value)"?
Note: their example of a similar piece of code is not identical, as it won't cast values like null to false. I think the best example of a clear equivalent would be:
value = value ? true : false;Compare:
> typeof Boolean(1)
'boolean'
> typeof new Boolean(1)
'object'