<?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: Array Extras</title>
	<atom:link href="http://erik.eae.net/archives/2005/06/05/17.53.19/feed/" rel="self" type="application/rss+xml" />
	<link>http://erik.eae.net/archives/2005/06/05/17.53.19/</link>
	<description>The Weblog of Erik Arvidsson</description>
	<pubDate>Thu, 28 Aug 2008 14:16:19 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
		<item>
		<title>By: Patrick Kwinten</title>
		<link>http://erik.eae.net/archives/2005/06/05/17.53.19/#comment-103036</link>
		<dc:creator>Patrick Kwinten</dc:creator>
		<pubDate>Wed, 26 Mar 2008 14:41:57 +0000</pubDate>
		<guid isPermaLink="false">http://erik.eae.net/archives/2005/06/05/17.48.00/#comment-103036</guid>
		<description>thanks for the help, I had some problem with using prototype and defining arrays, some how using

var tagMap= new Array()

causes that prototype adds other elements to the array :-?</description>
		<content:encoded><![CDATA[<p>thanks for the help, I had some problem with using prototype and defining arrays, some how using</p>
<p>var tagMap= new Array()</p>
<p>causes that prototype adds other elements to the array <img src='http://erik.eae.net/wp-includes/images/smilies/icon_confused.gif' alt=':-?' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JavaScript Scripting Essentials</title>
		<link>http://erik.eae.net/archives/2005/06/05/17.53.19/#comment-86595</link>
		<dc:creator>JavaScript Scripting Essentials</dc:creator>
		<pubDate>Thu, 01 Mar 2007 11:16:55 +0000</pubDate>
		<guid isPermaLink="false">http://erik.eae.net/archives/2005/06/05/17.48.00/#comment-86595</guid>
		<description>[...] Dan Webb asks what are your JavaScript essentials? Those bits and pieces you can&#8217;t live without that get copy/pasted from project to project. His pragmatic list includes the $ function, getElementsByClassName, Dean&#8217;s event handling, the JS 1.6 array methods, and the DOMContentLoaded event. His full script that he guarantees he _won&#8217;t_ support is here. [...]</description>
		<content:encoded><![CDATA[<p>[...] Dan Webb asks what are your JavaScript essentials? Those bits and pieces you can&#8217;t live without that get copy/pasted from project to project. His pragmatic list includes the $ function, getElementsByClassName, Dean&#8217;s event handling, the JS 1.6 array methods, and the DOMContentLoaded event. His full script that he guarantees he _won&#8217;t_ support is here. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scripting Essentials &#187; Professional Web Software Development</title>
		<link>http://erik.eae.net/archives/2005/06/05/17.53.19/#comment-68111</link>
		<dc:creator>Scripting Essentials &#187; Professional Web Software Development</dc:creator>
		<pubDate>Tue, 23 Jan 2007 21:01:02 +0000</pubDate>
		<guid isPermaLink="false">http://erik.eae.net/archives/2005/06/05/17.48.00/#comment-68111</guid>
		<description>[...] Javascript&#8217;s new forEach() function. Thanks to Dean Edwards, there is a cross browser solution, that is extremely simple to use. There are some other new functions as well that I haven&#8217;t explored yet, but they are worth noting. [...]</description>
		<content:encoded><![CDATA[<p>[...] Javascript&#8217;s new forEach() function. Thanks to Dean Edwards, there is a cross browser solution, that is extremely simple to use. There are some other new functions as well that I haven&#8217;t explored yet, but they are worth noting. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ajaxian &#187; JavaScript Scripting Essentials</title>
		<link>http://erik.eae.net/archives/2005/06/05/17.53.19/#comment-64969</link>
		<dc:creator>Ajaxian &#187; JavaScript Scripting Essentials</dc:creator>
		<pubDate>Sun, 14 Jan 2007 22:48:23 +0000</pubDate>
		<guid isPermaLink="false">http://erik.eae.net/archives/2005/06/05/17.48.00/#comment-64969</guid>
		<description>[...] Dan Webb asks what are your JavaScript essentials? Those bits and pieces you can&#8217;t live without that get copy/pasted from project to project. His pragmatic list includes the $ function, getElementsByClassName, Dean&#8217;s event handling, the JS 1.6 array methods, and the DOMContentLoaded event. His full script that he guarantees he _won&#8217;t_ support is here. [...]</description>
		<content:encoded><![CDATA[<p>[...] Dan Webb asks what are your JavaScript essentials? Those bits and pieces you can&#8217;t live without that get copy/pasted from project to project. His pragmatic list includes the $ function, getElementsByClassName, Dean&#8217;s event handling, the JS 1.6 array methods, and the DOMContentLoaded event. His full script that he guarantees he _won&#8217;t_ support is here. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Erik Arvidsson</title>
		<link>http://erik.eae.net/archives/2005/06/05/17.53.19/#comment-55699</link>
		<dc:creator>Erik Arvidsson</dc:creator>
		<pubDate>Tue, 26 Dec 2006 21:55:58 +0000</pubDate>
		<guid isPermaLink="false">http://erik.eae.net/archives/2005/06/05/17.48.00/#comment-55699</guid>
		<description>Jan: That is just a typo. You should remove that.</description>
		<content:encoded><![CDATA[<p>Jan: That is just a typo. You should remove that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jan van Casteren</title>
		<link>http://erik.eae.net/archives/2005/06/05/17.53.19/#comment-52846</link>
		<dc:creator>Jan van Casteren</dc:creator>
		<pubDate>Mon, 18 Dec 2006 15:58:13 +0000</pubDate>
		<guid isPermaLink="false">http://erik.eae.net/archives/2005/06/05/17.48.00/#comment-52846</guid>
		<description>Thank you for this handy script. One question: is there any reason to have the obj parameter in the copy method? 

See:

Array.prototype.copy = function (obj) {
	return this.concat();
};</description>
		<content:encoded><![CDATA[<p>Thank you for this handy script. One question: is there any reason to have the obj parameter in the copy method? </p>
<p>See:</p>
<p>Array.prototype.copy = function (obj) {<br />
	return this.concat();<br />
};</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Walden</title>
		<link>http://erik.eae.net/archives/2005/06/05/17.53.19/#comment-52418</link>
		<dc:creator>Jeff Walden</dc:creator>
		<pubDate>Sun, 17 Dec 2006 15:17:57 +0000</pubDate>
		<guid isPermaLink="false">http://erik.eae.net/archives/2005/06/05/17.48.00/#comment-52418</guid>
		<description>Actually, let me backtrack for a second -- I'm not sure the docs I was referencing were canonical.  I'll get back with more details later...</description>
		<content:encoded><![CDATA[<p>Actually, let me backtrack for a second &#8212; I&#8217;m not sure the docs I was referencing were canonical.  I&#8217;ll get back with more details later&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Walden</title>
		<link>http://erik.eae.net/archives/2005/06/05/17.53.19/#comment-52417</link>
		<dc:creator>Jeff Walden</dc:creator>
		<pubDate>Sun, 17 Dec 2006 15:12:33 +0000</pubDate>
		<guid isPermaLink="false">http://erik.eae.net/archives/2005/06/05/17.48.00/#comment-52417</guid>
		<description>Your code for Array.prototype.lastIndexOf has a bug in it: when the second argument is a negative number and the sum of that argument and the array's length is less than zero, you might erroneously return 0 when searching for the first element in the array.  For example:

[2].lastIndexOf(2, -5)

...will return 0 with your code, when according to the function's description it should return -1.  The fix should be to replace &#124;Math.max(0, this.length + fromIndex)&#124; with &#124;this.length + fromIndex&#124; in the lastIndexOf implementation.

Also, don't bother testing behavior in Firefox, because Firefox has this bug (and an indexOf bug which is a little harder to duplicate). I'm checking whether non-Firefox implementations demonstrate this and the other bug to evaluate how feasible it is to fix this behavior in point releases to stable Firefox versions.  (The bug is https://bugzilla.mozilla.org/show_bug.cgi?id=364104 if you're interested.)</description>
		<content:encoded><![CDATA[<p>Your code for Array.prototype.lastIndexOf has a bug in it: when the second argument is a negative number and the sum of that argument and the array&#8217;s length is less than zero, you might erroneously return 0 when searching for the first element in the array.  For example:</p>
<p>[2].lastIndexOf(2, -5)</p>
<p>&#8230;will return 0 with your code, when according to the function&#8217;s description it should return -1.  The fix should be to replace |Math.max(0, this.length + fromIndex)| with |this.length + fromIndex| in the lastIndexOf implementation.</p>
<p>Also, don&#8217;t bother testing behavior in Firefox, because Firefox has this bug (and an indexOf bug which is a little harder to duplicate). I&#8217;m checking whether non-Firefox implementations demonstrate this and the other bug to evaluate how feasible it is to fix this behavior in point releases to stable Firefox versions.  (The bug is <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=364104" rel="nofollow">https://bugzilla.mozilla.org/show_bug.cgi?id=364104</a> if you&#8217;re interested.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Johan Sundström</title>
		<link>http://erik.eae.net/archives/2005/06/05/17.53.19/#comment-35595</link>
		<dc:creator>Johan Sundström</dc:creator>
		<pubDate>Sun, 05 Nov 2006 11:30:11 +0000</pubDate>
		<guid isPermaLink="false">http://erik.eae.net/archives/2005/06/05/17.48.00/#comment-35595</guid>
		<description>More of a reflection than suggestion: testing for Array.prototype.forEach and friends this way rather than by way of Array.prototype.hasOwnProperty('forEach') will find Object.prototype.forEach when no Array specific implementation exists. This is probably still often what you want, assuming that the Object prototype internally handles different data types differently in sane manners, but once in a while it might not be.</description>
		<content:encoded><![CDATA[<p>More of a reflection than suggestion: testing for Array.prototype.forEach and friends this way rather than by way of Array.prototype.hasOwnProperty(&#8217;forEach&#8217;) will find Object.prototype.forEach when no Array specific implementation exists. This is probably still often what you want, assuming that the Object prototype internally handles different data types differently in sane manners, but once in a while it might not be.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thomas Frank</title>
		<link>http://erik.eae.net/archives/2005/06/05/17.53.19/#comment-20110</link>
		<dc:creator>Thomas Frank</dc:creator>
		<pubDate>Fri, 14 Jul 2006 12:00:15 +0000</pubDate>
		<guid isPermaLink="false">http://erik.eae.net/archives/2005/06/05/17.48.00/#comment-20110</guid>
		<description>Brilliant! Thanks!</description>
		<content:encoded><![CDATA[<p>Brilliant! Thanks!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
