<?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/"
xmlns:series="http://unfoldingneurons.com/"
> <channel><title>Comments on: Access JavaScript Object Variable&#160;Properties</title> <atom:link href="http://davidwalsh.name/access-object-properties/feed" rel="self" type="application/rss+xml" /><link>http://davidwalsh.name/access-object-properties</link> <description>Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞.</description> <lastBuildDate>Mon, 21 May 2012 07:46:19 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.2</generator> <item><title>By: Rudolf Leermakers</title><link>http://davidwalsh.name/access-object-properties#comment-14936</link> <dc:creator>Rudolf Leermakers</dc:creator> <pubDate>Thu, 31 Dec 2009 14:59:24 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=4252#comment-14936</guid> <description>@Timothy:  While it is preferable to avoid eval in code that need not be written in that form, as you show, I would like to contest that eval is far from evil.It&#039;s a basic language construct upon which the entire functional programming paradigm can be built in languages that do not support it natively. Sometimes a problem is better expressed in said paradigm, but the language prevents you from properly exploiting it&#039;s capabilities. This is one of the many ways eval *can* be used for the better of your programming speed, debug-ability and general style of programming.So please, next time you wish to share your opinion on eval, try to think of the grand picture this language construct fits in, and don&#039;t spread lies about otherwise finely crafted implementations thereof.</description> <content:encoded><![CDATA[<p>@Timothy:  While it is preferable to avoid eval in code that need not be written in that form, as you show, I would like to contest that eval is far from evil.</p><p>It&#8217;s a basic language construct upon which the entire functional programming paradigm can be built in languages that do not support it natively. Sometimes a problem is better expressed in said paradigm, but the language prevents you from properly exploiting it&#8217;s capabilities. This is one of the many ways eval *can* be used for the better of your programming speed, debug-ability and general style of programming.</p><p>So please, next time you wish to share your opinion on eval, try to think of the grand picture this language construct fits in, and don&#8217;t spread lies about otherwise finely crafted implementations thereof.</p> ]]></content:encoded> </item> <item><title>By: Timothy</title><link>http://davidwalsh.name/access-object-properties#comment-14031</link> <dc:creator>Timothy</dc:creator> <pubDate>Mon, 30 Nov 2009 13:39:06 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=4252#comment-14031</guid> <description>It&#039;s a good thing to point out that you can almost always avoid eval() by use of myObject[&#039;key&#039;] reference. for example:var myObject = {};$H({
&#039;a&#039;: 1,
&#039;b&#039;: 2,
&#039;c&#039;: 3
}).each(function(v, k) {
myObject[k] = v;
});A lot of people think you have to do something like:var myObject = {};$H({
&#039;a&#039;: 1,
&#039;b&#039;: 2,
&#039;c&#039;: 3
}).each(function(v, k) {
eval(&#039;myObject.&#039; + k + &#039; = &#039; + v);
});Avoid eval! Eval is evil.</description> <content:encoded><![CDATA[<p>It&#8217;s a good thing to point out that you can almost always avoid eval() by use of myObject['key'] reference. for example:</p><p>var myObject = {};</p><p>$H({<br
/> &#8216;a&#8217;: 1,<br
/> &#8216;b&#8217;: 2,<br
/> &#8216;c&#8217;: 3<br
/> }).each(function(v, k) {<br
/> myObject[k] = v;<br
/> });</p><p>A lot of people think you have to do something like:</p><p>var myObject = {};</p><p>$H({<br
/> &#8216;a&#8217;: 1,<br
/> &#8216;b&#8217;: 2,<br
/> &#8216;c&#8217;: 3<br
/> }).each(function(v, k) {<br
/> eval(&#8216;myObject.&#8217; + k + &#8216; = &#8216; + v);<br
/> });</p><p>Avoid eval! Eval is evil.</p> ]]></content:encoded> </item> <item><title>By: Chris the Developer</title><link>http://davidwalsh.name/access-object-properties#comment-13970</link> <dc:creator>Chris the Developer</dc:creator> <pubDate>Thu, 26 Nov 2009 06:17:01 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=4252#comment-13970</guid> <description>@keith - huh...never knew that. Thanks! :D</description> <content:encoded><![CDATA[<p>@keith &#8211; huh&#8230;never knew that. Thanks! :D</p> ]]></content:encoded> </item> <item><title>By: Keith</title><link>http://davidwalsh.name/access-object-properties#comment-13962</link> <dc:creator>Keith</dc:creator> <pubDate>Wed, 25 Nov 2009 21:45:03 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=4252#comment-13962</guid> <description>@Chris - PHP&#039;s ArrayObject class allows you to access properties using array syntax.</description> <content:encoded><![CDATA[<p>@Chris &#8211; PHP&#8217;s ArrayObject class allows you to access properties using array syntax.</p> ]]></content:encoded> </item> <item><title>By: dev</title><link>http://davidwalsh.name/access-object-properties#comment-13960</link> <dc:creator>dev</dc:creator> <pubDate>Wed, 25 Nov 2009 16:33:17 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=4252#comment-13960</guid> <description>never knew this method, very useful.</description> <content:encoded><![CDATA[<p>never knew this method, very useful.</p> ]]></content:encoded> </item> <item><title>By: Chris the Developer</title><link>http://davidwalsh.name/access-object-properties#comment-13959</link> <dc:creator>Chris the Developer</dc:creator> <pubDate>Wed, 25 Nov 2009 16:10:16 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=4252#comment-13959</guid> <description>@Colin - I just love how object property keys and array indexes are treated as equal in Javascript. The closest to this coolness that PHP comes is in pseudo-property keys ($obj-&gt;$var_key)</description> <content:encoded><![CDATA[<p>@Colin &#8211; I just love how object property keys and array indexes are treated as equal in Javascript. The closest to this coolness that PHP comes is in pseudo-property keys ($obj-&gt;$var_key)</p> ]]></content:encoded> </item> <item><title>By: Colin Gillies</title><link>http://davidwalsh.name/access-object-properties#comment-13956</link> <dc:creator>Colin Gillies</dc:creator> <pubDate>Wed, 25 Nov 2009 14:09:52 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=4252#comment-13956</guid> <description>I&#039;m a big fan of myObject[key] as its close to the PHP array syntax. Just personal preference really and it gives great flexibility and easy to test for.</description> <content:encoded><![CDATA[<p>I&#8217;m a big fan of myObject[key] as its close to the PHP array syntax. Just personal preference really and it gives great flexibility and easy to test for.</p> ]]></content:encoded> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced (User agent is rejected)
Database Caching 3/7 queries in 0.007 seconds using disk: basic
Object Caching 628/628 objects using disk: basic

Served from: davidwalsh.name @ 2012-05-21 03:11:37 -->
