Door Games Unlimited

Welcome, Guest.


Subject: syncWXremix and Dial-up Date: Sat Jan 09 2016 19:59:22
From: Digital Man To: Nightfox

  Re: syncWXremix and Dial-up
  By: Nightfox to KenDB3 on Thu Jan 07 2016 12:52 pm

 >  > I started using some mock data (since I don't have dialup to test with).
 >  > I think I figured this out.
 >
 >  > function getQuerySuffix() {
 >  > var qs;
 >  > if (dialup === 'true')
 >
 >  > ...should be...
 >
 >  > function getQuerySuffix() {
 >  > var qs;
 >  > if (dialup === true)
 >
 >  > This makes it through the function by grabbing the correct fallback
 >  > lookup.
 >
 >  > Triple Equals works... At some point I tried Double Equals instead (stil
 >  > works). Should I stick with Triple? I read up on the difference, but not
 >  > sure if one might be better than the other in this particular case.
 >
 > Isn't the "=== true" redundant?  Saying "if (dialup)" should be enough, and
 > it's just as clear as saying "if (dialup === true)", since that has the same
 > meaning.

Usually, and in the case of this particular script, if(dialup) and if(dialup ==
true) and if(dialup === true) are all functionally equivalent.

However, technically if(dialup) is the equivalent of: if(dialup != false),
because if dialup = 2, let's say, then if(dialup == true) or if(dialup ===
true) would not execute the if-block while if(dialup) would still execute the
if-block. if(Boolean(dialup) == true) is the equivalent of if(dialup). :-)

                                            digital man

Synchronet "Real Fact" #82:
Donations to the Synchronet project are welcome @ http://wiki.synchro.net/donate
Norco, CA WX: 51.8°F, 81.0% humidity, 1 mph SSE wind, 0.00 inches rain/24hrs

---
 ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ telnet://vert.synchro.net

Previous Message       Next Message
In Reply To: syncWXremix and Dial-up (Nightfox)
Replies: syncWXremix and Dial-up (Nightfox)Re: syncWXremix and Dial-up (KenDB3)