<?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"
	>
<channel>
	<title>Comments on: JavaScript shortcut notations that shouldn&#8217;t be black magic to the &#8220;average developer&#8221;</title>
	<atom:link href="http://www.wait-till-i.com/2007/11/27/javascript-shortcut-notations-that-shouldnt-be-black-magic-to-the-average-developer/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.wait-till-i.com/2007/11/27/javascript-shortcut-notations-that-shouldnt-be-black-magic-to-the-average-developer/</link>
	<description>Chris Heilmann - Accessibility, Web Development and Pragmatism - can talk, will travel</description>
	<pubDate>Mon, 06 Oct 2008 19:31:01 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Julien Wajsberg</title>
		<link>http://www.wait-till-i.com/2007/11/27/javascript-shortcut-notations-that-shouldnt-be-black-magic-to-the-average-developer/#comment-6683</link>
		<dc:creator>Julien Wajsberg</dc:creator>
		<pubDate>Wed, 05 Dec 2007 22:54:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.wait-till-i.com/2007/11/27/javascript-shortcut-notations-that-shouldnt-be-black-magic-to-the-average-developer/#comment-6683</guid>
		<description>- "The semicolons get replaced by commas (except for the last one which you need to omit)"
And I'll add that if you forget to remove the last one, the whole script is just silently ignored by Internet Explorer.

- About the "assoative arrays really are objects": the best of it is that it's exactly the same with ActionScript. :-)

- About the ternary expression: my view is that it's just less maintenable code in the long run...</description>
		<content:encoded><![CDATA[<p>- &#8220;The semicolons get replaced by commas (except for the last one which you need to omit)&#8221;<br />
And I&#8217;ll add that if you forget to remove the last one, the whole script is just silently ignored by Internet Explorer.</p>
<p>- About the &#8220;assoative arrays really are objects&#8221;: the best of it is that it&#8217;s exactly the same with ActionScript. :-)</p>
<p>- About the ternary expression: my view is that it&#8217;s just less maintenable code in the long run&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JeanHuguesRobert</title>
		<link>http://www.wait-till-i.com/2007/11/27/javascript-shortcut-notations-that-shouldnt-be-black-magic-to-the-average-developer/#comment-6667</link>
		<dc:creator>JeanHuguesRobert</dc:creator>
		<pubDate>Wed, 05 Dec 2007 12:51:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.wait-till-i.com/2007/11/27/javascript-shortcut-notations-that-shouldnt-be-black-magic-to-the-average-developer/#comment-6667</guid>
		<description>&#38;&#38; operator "Progressive And" is nice too.

I use it for my de&#38;&#38;bug( "http://virteal.com/DebugDarling");</description>
		<content:encoded><![CDATA[<p>&amp;&amp; operator &#8220;Progressive And&#8221; is nice too.</p>
<p>I use it for my de&amp;&amp;bug( &#8220;http://virteal.com/DebugDarling&#8221;);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Banned in Boston</title>
		<link>http://www.wait-till-i.com/2007/11/27/javascript-shortcut-notations-that-shouldnt-be-black-magic-to-the-average-developer/#comment-6633</link>
		<dc:creator>Banned in Boston</dc:creator>
		<pubDate>Fri, 30 Nov 2007 19:48:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.wait-till-i.com/2007/11/27/javascript-shortcut-notations-that-shouldnt-be-black-magic-to-the-average-developer/#comment-6633</guid>
		<description>@Milo: you said

"... If the left-hand operand resolves to “true” then it is returned, otherwise the right-hand operand is returned. This is exactly the same as the “or” operator in any other language."

Sorry, but not all languages work that way. For example, some languages will evaluate BOTH sides of an OR operator before checking to see if at least one of them has evaluated to true. (If memory serves, VB works that way.)

For many programming tasks, it doesn't matter whether the OR operator evaluates both operands first, or just the left one first. However, there are some situations where is does matter, and there are (increasingly common) JS idioms that depend on this 'short-circuit' behavior.

I'm also skeptical of the idea that OR operators in all languages return one of their operands (when neither of them evaluate to false). I believe that some languages return a Boolean value in that case. 

My apologies if the above comes across as pedantic, but I believe that this (seemingly subtle) bit of behavior actually is something experience Programmers care about. Personally, I know that whenever I am learning a new language I always check to see if the OR operator supports 'short-circuit' evaluation (or not).</description>
		<content:encoded><![CDATA[<p>@Milo: you said</p>
<p>&#8220;&#8230; If the left-hand operand resolves to &acirc;true&acirc; then it is returned, otherwise the right-hand operand is returned. This is exactly the same as the &acirc;or&acirc; operator in any other language.&#8221;</p>
<p>Sorry, but not all languages work that way. For example, some languages will evaluate <span class="caps">BOTH </span>sides of an OR operator before checking to see if at least one of them has evaluated to true. (If memory serves, VB works that way.)</p>
<p>For many programming tasks, it doesn&#8217;t matter whether the OR operator evaluates both operands first, or just the left one first. However, there are some situations where is does matter, and there are (increasingly common) JS idioms that depend on this &#8217;short-circuit&#8217; behavior.</p>
<p>I&#8217;m also skeptical of the idea that OR operators in all languages return one of their operands (when neither of them evaluate to false). I believe that some languages return a Boolean value in that case. </p>
<p>My apologies if the above comes across as pedantic, but I believe that this (seemingly subtle) bit of behavior actually is something experience Programmers care about. Personally, I know that whenever I am learning a new language I always check to see if the OR operator supports &#8217;short-circuit&#8217; evaluation (or not).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kenman</title>
		<link>http://www.wait-till-i.com/2007/11/27/javascript-shortcut-notations-that-shouldnt-be-black-magic-to-the-average-developer/#comment-6629</link>
		<dc:creator>kenman</dc:creator>
		<pubDate>Fri, 30 Nov 2007 08:58:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.wait-till-i.com/2007/11/27/javascript-shortcut-notations-that-shouldnt-be-black-magic-to-the-average-developer/#comment-6629</guid>
		<description>aka "syntactic sugar"</description>
		<content:encoded><![CDATA[<p>aka &#8220;syntactic sugar&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DaveG</title>
		<link>http://www.wait-till-i.com/2007/11/27/javascript-shortcut-notations-that-shouldnt-be-black-magic-to-the-average-developer/#comment-6625</link>
		<dc:creator>DaveG</dc:creator>
		<pubDate>Thu, 29 Nov 2007 22:13:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.wait-till-i.com/2007/11/27/javascript-shortcut-notations-that-shouldnt-be-black-magic-to-the-average-developer/#comment-6625</guid>
		<description>@Chris: Or, shortened to obscurity:

function loopproperties(o){
    for(i in o)
        i + ':' + (typeof o[i]!== 'object') ? o[i] : loopproperties(o[i]) + '\n';
};
console.log(loopproperties(o));</description>
		<content:encoded><![CDATA[<p>@Chris: Or, shortened to obscurity:</p>
<p>function loopproperties(o){<br />
    for(i in o)<br />
        i + &#8216;:&#8217; + (typeof o[i]!== &#8216;object&#8217;) ? o[i] : loopproperties(o[i]) + &#8216;\n&#8217;;<br />
};<br />
console.log(loopproperties(o));</p>
]]></content:encoded>
	</item>
</channel>
</rss>
