<?xml version='1.0' encoding='ISO-8859-1'?>
<?xml-stylesheet type='text/xsl' href='docs.xsl'?>
<docs>
<method cat='JavaScript' type='Object' short='A generic iterator function, which can be used to seamlessly iterate over both objects and arrays.' name='$.each'>
<desc>A generic iterator function, which can be used to seamlessly
iterate over both objects and arrays. This function is not the same
as $().each() - which is used to iterate, exclusively, over a jQuery
object. This function can be used to iterate over anything.

The callback has two arguments:the key (objects) or index (arrays) as first
the first, and the value as the second.</desc>
<params type='Object' name='obj'>
<desc>The object, or array, to iterate over.</desc>
</params>
<params type='Function' name='fn'>
<desc>The function that will be executed on every object.</desc>
</params>
<examples>
<desc>This is an example of iterating over the items in an array,
accessing both the current item and its index.</desc>
<code>$.each( [0,1,2], function(i, n){
  alert( "Item #" + i + ": " + n );
});</code>
</examples>
<examples>
<desc>This is an example of iterating over the properties in an
Object, accessing both the current item and its key.</desc>
<code>$.each( { name: "John", lang: "JS" }, function(i, n){
  alert( "Name: " + i + ", Value: " + n );
});</code>
</examples>
</method></docs>
