Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #32407

Re: understanding the expression "ws && ~[2, 3].indexOf(ws.readyState)"

From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.javascript
Subject Re: understanding the expression "ws && ~[2, 3].indexOf(ws.readyState)"
Date 2017-01-28 15:33 +0000
Organization A noiseless patient Spider
Message-ID <874m0jurl9.fsf@bsb.me.uk> (permalink)
References <o6eo1r$ifl$1@shakotay.alphanet.ch> <878tpwzqct.fsf@bsb.me.uk> <o6fube$62g$1@shakotay.alphanet.ch> <XnsA70B6CBA8F9BCeejj99@194.109.6.166>

Show all headers | View raw


"Evertjan." <exxjxw.hannivoort@inter.nl.net> writes:
<snip>
>> Le 27/01/2017 … 12:36, Ben Bacarisse a ‚crit :
>>> Any non-zero number (other than NaN) is considered to be true in a
>>> Boolean context.
>
> Please reconsider:

What should I be re-considering?

> alert(0 == false) // true
> alert(0 === false) // false
>
> alert(17 == true) // false ???????????
> alert(true == 17) // false ???????????
> alert(!!17) // true

There is only one example of a non-zero number in a Boolean context
there and it behaves as I described.

Maybe I should have been explicit about what I meant by a Boolean
context.  It's where the abstract toBoolean operation is used in the
language specification.

<snip>
-- 
Ben.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

understanding the expression "ws && ~[2, 3].indexOf(ws.readyState)" Une Bévue <unbewusst.sein@fai.invalid> - 2017-01-27 07:06 +0100
  Re: understanding the expression "ws && ~[2, 3].indexOf(ws.readyState)" Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-01-27 11:36 +0000
    Re: understanding the expression "ws && ~[2, 3].indexOf(ws.readyState)" Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-01-27 13:04 +0100
    Re: understanding the expression "ws && ~[2, 3].indexOf(ws.readyState)" Une Bévue <unbewusst.sein@fai.invalid> - 2017-01-27 18:00 +0100
      Re: understanding the expression "ws && ~[2, 3].indexOf(ws.readyState)" "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-01-28 10:41 +0100
        Re: understanding the expression "ws && ~[2, 3].indexOf(ws.readyState)" Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-01-28 15:33 +0000
    Re: understanding the expression "ws && ~[2, 3].indexOf(ws.readyState)" Une Bévue <unbewusst.sein@fai.invalid> - 2017-01-29 09:12 +0100

csiph-web