Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #7847
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!news.davenulle.org!porbandar.httrack.net!news.httrack.net!exabot.com!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail |
|---|---|
| Content-Type | text/plain; charset="ISO-8859-1" |
| Message-ID | <2198638.IIGME3H9Hf@PointedEars.de> (permalink) |
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Reply-To | Thomas 'PointedEars' Lahn <cljs@PointedEars.de> |
| Organization | PointedEars Software (PES) |
| Date | Sun, 30 Oct 2011 22:00:50 +0100 |
| User-Agent | KNode/4.4.11 |
| Content-Transfer-Encoding | 7Bit |
| Subject | Re: meaning of (toto)? true : false |
| Newsgroups | comp.lang.javascript |
| References | <4eab9340$0$27929$426a34cc@news.free.fr> <a6dra7132v6ul7qp4lbsaofmek24geomnv@4ax.com> <j8kdke$uqs$1@news.albasani.net> |
| Followup-To | comp.lang.javascript |
| MIME-Version | 1.0 |
| Lines | 32 |
| NNTP-Posting-Date | 30 Oct 2011 22:00:50 CET |
| NNTP-Posting-Host | e4334d84.newsspool3.arcor-online.net |
| X-Trace | DXC=4iBiI<_mCn\U6b:FjPaGjQMcF=Q^Z^V3X4Fo<]lROoRQ8kF<OcfhCO[Vji1_n_VeiYDZm8W4\YJN\;?f@h5gMfb\5JLRX7TES^Vc?@@G_;b@N^ |
| X-Complaints-To | usenet-abuse@arcor.de |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.javascript:7847 |
Followups directed to: comp.lang.javascript
Show key headers only | View raw
Andreas Bergmaier wrote:
> Hans-Georg Michna schrieb:
>> ? true : false
>> is another way to write,
>> "I don't understand JavaScript."
>>
>> If you really have to transform something into a boolean that
>> isn't already one, just write !! in front of it, but think again
^^^^^^^^^^^^^^^^^^^^^^^
>> whether that is really needed.
>
> I'm sure in his application he uses other values like strings. This
> console.log-thing was just to show his problem. Of course he could have
> written:
> console.log("Why is this "+foo ? "true" : "false" + "?")
You appear to have missed the point:
console.log("Why is this " + !!foo + "?");
> but does it matter?
If it leads to inefficient, error-prone code, then yes.
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
meaning of (toto)? true : false Une Bévue <unbewusst.sein@fai.invalid> - 2011-10-29 07:46 +0200
Re: meaning of (toto)? true : false Une Bévue <unbewusst.sein@fai.invalid> - 2011-10-29 07:53 +0200
Re: meaning of (toto)? true : false "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2011-10-29 14:47 -0700
Re: meaning of (toto)? true : false Une Bévue <unbewusst.sein@fai.invalid> - 2011-10-30 05:37 +0100
Re: meaning of (toto)? true : false Hans-Georg Michna <hans-georgNoEmailPlease@michna.com> - 2011-10-30 21:38 +0100
Re: meaning of (toto)? true : false Andreas Bergmaier <andber93@web.de> - 2011-10-30 21:55 +0100
Re: meaning of (toto)? true : false Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-30 22:00 +0100
Re: meaning of (toto)? true : false Dr J R Stockton <reply1144@merlyn.demon.co.uk> - 2011-10-31 18:06 +0000
csiph-web