Path: csiph.com!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: Christoph Becker Newsgroups: comp.lang.javascript Subject: Re: Programming style question Date: Mon, 22 Oct 2012 22:11:06 +0200 Organization: Aioe.org NNTP Server Lines: 18 Message-ID: References: NNTP-Posting-Host: LuobEXmntR9cApKsZyhy4A.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com comp.lang.javascript:16804 Tim Streater wrote: > In article , > Dr J R Stockton wrote: > >> console.info( (n||"No") + " results" ) ; // ?? > > I find constructs such as this to be unreadable. I never use them since > I don't want to spend 20 mins figuring it out the first time, and > another 20 mins convincing myself it's correct each time I come across it. If I'm not mistaken the following expression evaluates to true for all a,b: (a ? a : b) === (a || b) So (a || b) could be seen as short-cut for the ternary operator. -- Christoph M. Becker