On Fri, Dec 14, 2012 at 2:43 AM, Andreas Rossberg <[email protected]> wrote:
> On 14 December 2012 06:46, John-David Dalton
> <[email protected]> wrote:
>>Axel Rauschmayer:
>>> Honest question: I have yet to see boxed values in practice. Are there any
>>> real use cases?
>>
>> See Modernizr:
>> https://github.com/Modernizr/Modernizr/blob/master/feature-detects/video.js#L23
>
> I think not. And wrapping bools, like the above piece of code does, is
> a particularly bad idea, because JS says
>
> (Object(false) ? 1 : 2) === 1
Fortunately, I think that bit of code never returns Object(false),
because the `if` fails first, and just plain `false` is returned.
Really, since objects are truthy, `new Boolean(bool)` there could be
replaced with `{}`. Or, the whole body of the `if` could just be an
object literal.
Sam
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss