Door Games Unlimited

Welcome, Guest.


Subject: Re: syncWXremix and Dial-up Date: Sun Jan 10 2016 18:14:49
From: Deuce To: Digital Man

  Re: Re: syncWXremix and Dial-up
  By: Digital Man to tracker1 on Sun Jan 10 2016 02:54 pm

 >  > The following values evaluate as false in JS:
 >  >   0, undefined, mull, NaN, false, empty string
 >
 >  > Everything else is true.
 >
 > Not when testing for equality (and that was the original question). For
 > example: print(2==true), prints 'false'.

But print('0x01'==true) prints 'true'.

So here's a super-duper example...
[1, '1', '0x01', 2, '2', "true", true].forEach(function (x)
{
        print("X="+x+' '+(typeof x));
        if (x)
                print("Is");
        if (x==true)
                print("True");
        if (x===true)
                print("Truth");
        print('');
});

Which results in:
X=1 number
Is
True

X=1 string
Is
True

X=0x01 string
Is
True

X=2 number
Is

X=2 string
Is

X=true string
Is

X=true boolean
Is
True
Truth


---
http://DuckDuckGo.com/ a better search engine that respects your privacy.
Mro is an idiot.  Please ignore him, we keep hoping he'll go away.
 ■ Synchronet ■ My Brand-New BBS (All the cool SysOps run STOCK!)

Previous Message       Next Message
In Reply To: Re: syncWXremix and Dial-up (Digital Man)