Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions entries/jQuery.each.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
<title>jQuery.each()</title>
<signature>
<added>1.0</added>
<argument name="array" type="Array">
<desc>The array to iterate over.</desc>
<argument name="array" type="ArrayLikeObject">
<desc>The array or array-like object to iterate over.</desc>
</argument>
<argument name="callback" type="Function">
<argument name="indexInArray" type="Integer" />
<argument name="value" type="Object" />
<desc>The function that will be executed on every object.</desc>
<desc>The function that will be executed on every value.</desc>
</argument>
</signature>
<signature>
Expand All @@ -20,13 +20,12 @@
<argument name="callback" type="Function">
<argument name="propertyName" type="String" />
<argument name="valueOfProperty" type="Object" />
<desc>The function that will be executed on every object.</desc>
<desc>The function that will be executed on every value.</desc>
</argument>
</signature>
<desc>A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties.</desc>
<longdesc>
<p>The <code>$.each()</code> function is not the same as <a href="/each/">$(selector).each()</a>, which is used to iterate, exclusively, over a jQuery object. The <code>$.each()</code> function can be used to iterate over any collection, whether it is an object or an array. In the case of an array, the callback is passed an array index and a corresponding array value each time. (The value can also be accessed through the <code>this</code> keyword, but Javascript will always wrap the <code>this</code> value as an <code>Object</code> even if it is a simple string or number value.) The method returns its first argument, the object that was iterated.</p>
<p><b>Note:</b> The <code>$.each()</code> function internally retrieves and uses the <code>length</code> property of the passed collection. So, if the collection has a property called <code>length</code> — e.g. <code>{bar: 'foo', length: 10}</code> — the function might not work as expected.</p>
<pre><code>
$.each([ 52, 97 ], function( index, value ) {
alert( index + ": " + value );
Expand Down