<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How to use ternary operator in javascript?</title>
	<atom:link href="http://www.gsdesign.ro/blog/how-to-use-ternary-operator-in-javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gsdesign.ro/blog/how-to-use-ternary-operator-in-javascript/</link>
	<description>Just another developer blog</description>
	<lastBuildDate>Sat, 11 Feb 2012 02:17:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: James</title>
		<link>http://www.gsdesign.ro/blog/how-to-use-ternary-operator-in-javascript/comment-page-1/#comment-7713</link>
		<dc:creator>James</dc:creator>
		<pubDate>Mon, 11 Jan 2010 16:14:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.gsdesign.ro/blog/?p=243#comment-7713</guid>
		<description>Also when describing how to use the ternary operator putting&lt;br&gt;&lt;code&gt;var y = (x == 3);&lt;/code&gt;&lt;br&gt;Is pretty useless Regardless of Boolean or String.&lt;br&gt;&lt;code&gt;var y = (x == 3) ? true : false;&lt;/code&gt;&lt;br&gt;is the best example as it shows the user full use of the ternary including using for assignment.&lt;br&gt;The original example could be edited to&lt;br&gt;&lt;code&gt;(x == 3) ? y=&quot;true&quot; : z=&quot;true&quot;;&lt;/code&gt;&lt;br&gt;So the user can see that the operator is used to assign values to multiple variables.</description>
		<content:encoded><![CDATA[<p>Also when describing how to use the ternary operator putting<br /><code>var y = (x == 3);</code><br />Is pretty useless Regardless of Boolean or String.<br /><code>var y = (x == 3) ? true : false;</code><br />is the best example as it shows the user full use of the ternary including using for assignment.<br />The original example could be edited to<br /><code>(x == 3) ? y="true" : z="true";</code><br />So the user can see that the operator is used to assign values to multiple variables.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: j87</title>
		<link>http://www.gsdesign.ro/blog/how-to-use-ternary-operator-in-javascript/comment-page-1/#comment-7690</link>
		<dc:creator>j87</dc:creator>
		<pubDate>Wed, 09 Dec 2009 21:14:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.gsdesign.ro/blog/?p=243#comment-7690</guid>
		<description>It may be clearer to use &quot;var y = (x == 3);&quot;, but not the same. In the example, y is being assigned a string value &quot;true&quot; or &quot;false&quot;, not the boolean values true or false. i.e.&lt;br&gt;&lt;br&gt;&lt;script language=javascript&gt;&lt;br&gt;          var x = 3;&lt;br&gt;          var y = (x == 3) ? &quot;true&quot; : &quot;false&quot;;&lt;br&gt;	  var z = (x == 3);&lt;br&gt;	  a = z==y ? true : false;&lt;br&gt;	  document.write(y + &quot; &quot; + z + &quot; &quot; + a);&lt;br&gt;&lt;/script&gt;&lt;br&gt;&lt;br&gt;results in &quot;true true false&quot;&lt;br&gt;being that (true != &quot;true&quot;)</description>
		<content:encoded><![CDATA[<p>It may be clearer to use &#8220;var y = (x == 3);&#8221;, but not the same. In the example, y is being assigned a string value &#8220;true&#8221; or &#8220;false&#8221;, not the boolean values true or false. i.e.</p>
<p>&lt;script language=javascript&gt;<br />          var x = 3;<br />          var y = (x == 3) ? &#8220;true&#8221; : &#8220;false&#8221;;<br />	  var z = (x == 3);<br />	  a = z==y ? true : false;<br />	  document.write(y + &#8221; &#8221; + z + &#8221; &#8221; + a);<br />&lt;/script&gt;</p>
<p>results in &#8220;true true false&#8221;<br />being that (true != &#8220;true&#8221;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: OriginalCopy</title>
		<link>http://www.gsdesign.ro/blog/how-to-use-ternary-operator-in-javascript/comment-page-1/#comment-7468</link>
		<dc:creator>OriginalCopy</dc:creator>
		<pubDate>Mon, 13 Apr 2009 07:08:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.gsdesign.ro/blog/?p=243#comment-7468</guid>
		<description>What SALZ` said is the better, cleaner way.</description>
		<content:encoded><![CDATA[<p>What SALZ` said is the better, cleaner way.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Salz`</title>
		<link>http://www.gsdesign.ro/blog/how-to-use-ternary-operator-in-javascript/comment-page-1/#comment-7270</link>
		<dc:creator>Salz`</dc:creator>
		<pubDate>Tue, 30 Dec 2008 14:49:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.gsdesign.ro/blog/?p=243#comment-7270</guid>
		<description>what about: 
&lt;code&gt;
var y = (x == 3) ? true : false;
&lt;/code&gt;
or just
&lt;code&gt;
var y = (x == 3);
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>what about:<br />
<code><br />
var y = (x == 3) ? true : false;<br />
</code><br />
or just<br />
<code><br />
var y = (x == 3);<br />
</code></p>
]]></content:encoded>
	</item>
</channel>
</rss>

