<pclass="arguement"><strong>array</strong>The Array to translate.</p>
<pclass="arguement"><strong>callback(elementOfArray, indexInArray)</strong>The function to process each item against. The first argument to the function is the list item, the second argument is the index in array The function can return any value. <code>this</code> will be the global window object. </p>
</li></ul>
<divclass="longdesc">
<p>The $.map() method applies a function to each item in an array, collecting the results into a new array.</p>
<p>The translation function that is provided to this method is called for each item in the array and is passed two arguments: The item to be translated, and the index within the array.</p>
<p>The function can return:</p>
<ul>
<li>the translated value, which will be mapped to the resulting array</li>
<li>
<code>null</code>, to remove the item</li>
<li>an array of values, which will be flattened into the full array</li>
</ul>
<p>Map can iterate through Array-like objects, like a jQuery object, that have a length property.</p>
</div>
<h3>Examples:</h3>
<divid="entry-examples"class="entry-examples">
<divid="example-0">
<h4>Example: <spanclass="desc">A couple examples of using .map()</span>
<h4>Example: <spanclass="desc">Remove items by returning null from the function. This removes any numbers less than 50, and the rest are decreased by 45.</span>
</h4>
<pre><codeclass="example">$.map( [0, 1, 52, 97], function (a) { return (a > 50 ? a - 45 : null); } );</code></pre>
<h4>Result:</h4>
<pre><codeclass="results">[7, 52] </code></pre>
</div>
<divid="example-6">
<h4>Example: <spanclass="desc">Augmenting the resulting array by returning an array inside the function.</span>